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
* Evaluate solutions against criteria
* Evaluate against named links, include existing problem statements
* Add comparison matrix
* Add negative for solution 3 as suggested by @benjie
* Remove empty evaluations
@@ -181,7 +181,10 @@ Any data structure that can be modeled with output type polymorphism should be a
181
181
182
182
* Objection: composite input types and composite output types are distinct. Fields on composite output types support aliases and arguments whereas fields on composite input types do not. Marking an output field as non-nullable is a non-breaking change, but marking an input field as non-nullable is a breaking change.
183
183
184
-
### C) Doesn't inhibit [schema evolution](https://graphql.github.io/graphql-spec/draft/#sec-Validation.Type-system-evolution)
184
+
### C) Doesn't inhibit schema evolution
185
+
186
+
The GraphQL specification mentions the ability to evolve your schema as one of its core values:
Adding a new member type to an Input Union or doing any non-breaking change to existing member types does not result in breaking change. For example, adding a new optional field to member type or changing a field from non-nullable to nullable does not break previously valid client operations.
187
190
@@ -244,16 +247,33 @@ There have been a variety of use cases described by users asking for an abstract
244
247
245
248
## Possible Solutions
246
249
247
-
Broadly speaking, there are two categories of solutions to the problem of type discrimination:
248
-
249
-
* Value-based discriminator field
250
-
* Structural discrimination
251
-
252
-
### Value-based discriminator field
253
-
254
-
These solutions rely the **value** of a specific input field to determine the concrete type.
255
-
256
-
#### Single `__typename` field; value is the `type`
250
+
Each of the solutions should be evaluated against each of the criteria.
251
+
252
+
To get an overview, the following table broadly rates how good the solution fulfils
253
+
a certain criteria. Positive is always *good*, so if a criteria is something bad and
254
+
the solution does avoid the negative aspact, it gets a o
255
+
-`o` Positive
256
+
-`-` Neutral/Not applicable
257
+
-`x` Negative
258
+
259
+
|| 1 | 2 | 3 | 4 | 5 |
260
+
|---|---|---|---|---|---|
261
+
| A ||||||
262
+
| B ||||| x |
263
+
| C ||| x | x ||
264
+
| D ||||||
265
+
| E ||||||
266
+
| F ||||||
267
+
| G ||||||
268
+
| H | x | x ||||
269
+
| I ||||||
270
+
| J ||||||
271
+
| K ||||||
272
+
| L | x | x ||||
273
+
274
+
More detailed evaluations are to be placed in each solution's description.
275
+
276
+
### 1. Single `__typename` field; value is the `type`
257
277
258
278
This solution was discussed in https://github.com/graphql/graphql-spec/pull/395
#### Single user-chosen field; value is the `type`
315
+
#### Evaluation
316
+
317
+
##### [Input unions should accept plain data from clients](#h-input-unions-should-accept-plain-data-from-clients)
318
+
319
+
No, asthereisanadditionalfieldthathastobeadded.
320
+
321
+
##### [Input unions should be expressed efficiently in the query and on the wire](#k-input-unions-should-be-expressed-efficiently-in-the-query-and-on-the-wire)
322
+
323
+
Theadditionalfieldbloatsthequery.
324
+
325
+
### 2. Single user-chosen field; value is the `type`
##### [Input unions should be expressed efficiently in the query and on the wire](#k-input-unions-should-be-expressed-efficiently-in-the-query-and-on-the-wire)
0 commit comments