You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: rfcs/InputUnion.md
+3-17Lines changed: 3 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,24 +177,10 @@ Since the input object type is now a member of the input union, existing input o
177
177
178
178
To ease development.
179
179
180
-
### Input unions don't need "discriminator" field
180
+
### Input unions should accept plain data from clients
181
181
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.
198
184
199
185
### Input unions should be easy to upgrade from existing solutions
0 commit comments