Skip to content

Commit 4279bd5

Browse files
eapachebinaryseed
authored andcommitted
Remove fake solution criteria from input union (#639)
* Remove fake solution criteria from input union Criteria of the form "Uses solution x" or "Doesn't use solution x" are not real criteria. If solution x has benefits or issues not already captured, those criteria should be captured directly, instead of trying to sneak decisions about which solutions are acceptable into the criteria list. * Add back the underlying criteria The previous commit removed two criteria that were muddled with particular solutions. They did represent real criteria though: one of them was a duplicate of "Input polymorphism matches output polymorphism", and the other one is added in clearer language by this commit.
1 parent bc304ab commit 4279bd5

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

rfcs/InputUnion.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,10 @@ Since the input object type is now a member of the input union, existing input o
177177

178178
To ease development.
179179

180-
### Input unions don't need "discriminator" field
180+
### Input unions should accept plain data from clients
181181

182-
Differentiate types structurally, e.g. by checking the input value against each candidate input type in turn until a viable match is found.
183-
184-
* Objection: many input objects may not have unique required attributes (i.e. are heterogenous), leading to ambiguity.
185-
* Potential solution: input union order is signficant.
186-
* Objection: making a field in an input object nullable may result in an existing input value being interpretted as a different input object type at a later time (breaks forwards compatibility).
187-
* Objection: does not work with scalars.
188-
* Objection: this may have a noticable performance cost for larger input unions.
189-
190-
### Input unions don't use wrapper objects
191-
192-
For consistency with output unions/interfaces each union should resolve to a single JSON object; i.e. `{__typename:"MyInput",value:3}` rather than `{MyInput:{value:3}}`.
193-
194-
* Objection: wrapper objects can be more concise than including `__typename` or similar in each value.
195-
* Objection: the "tagged union" pattern is already in common usage.
196-
* Objection: this pattern enables support for leaf types (e.g. scalars) in unions.
197-
* Objection: this pattern enables support for individual input object list types in unions.
182+
Clients should be able to pass "natural" input data to unions without
183+
specially formatting it, adding extra metadata, or otherwise doing work.
198184

199185
### Input unions should be easy to upgrade from existing solutions
200186

0 commit comments

Comments
 (0)