@@ -231,7 +231,7 @@ Adding a new member type to an Input Union or doing any non-breaking change to e
231231
232232| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
233233| ----| ----| ----| ----| ----|
234- | ✅ | ⚠ | 🚫 | ⚠️ | ✅ |
234+ | ✅ | ✅⚠️ | 🚫 | ⚠️ | ✅ |
235235
236236Criteria score: 🥇
237237
@@ -325,7 +325,7 @@ input union IU = { x: String } | { y: Int }
325325
326326| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
327327| ----| ----| ----| ----| ----|
328- | ✅⚠️ | ✅⚠️ | ✅ | ⚠️ | ✅ |
328+ | ✅ | ✅ | ✅ | ⚠️ | ✅ |
329329
330330Criteria score: 🥉
331331
@@ -350,20 +350,17 @@ The less typing and fewer bytes transmitted, the better.
350350
351351| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
352352| ----| ----| ----| ----| ----|
353- | ✅ | ✅ | ✅ | ✅ | ✅ |
353+ | ✅ | ⚠️ | ✅ | ✅ | ✅ |
354354
355355Criteria score: 🥉
356356
357357## 🎯 L. Input unions should be performant for servers
358358
359359Ideally a server does not have to do much computation to determine which concrete type is represented by an input.
360360
361- * ✂️ Objection: None of the solutions discussed so far do anything that is computationally expensive.
362-
363361| [ 1] [ solution-1 ] | [ 2] [ solution-2 ] | [ 3] [ solution-3 ] | [ 4] [ solution-4 ] | [ 5] [ solution-5 ] |
364362| ----| ----| ----| ----| ----|
365- | ✅ | ✅ | ✅⚠️ | ✅⚠️ | ✅ |
366- | O(1) | O(1) | O(N of members) | O(N of members) | O(1) |
363+ | ✅ | ✅ | ⚠️ | ⚠️ | ✅ |
367364
368365Criteria score: 🥉
369366
@@ -473,13 +470,14 @@ type Mutation {
473470* [J. A GraphQL schema that supports input unions can be queried by older GraphQL clients][criteria-j]
474471 * ✅ Changes are additive only
475472* [K. Input unions should be expressed efficiently in the query and on the wire][criteria-k]
476- * ❔ Not evaluated
473+ * ✅ Discriminator field only needed when used in union
474+ * ✅ Compresses well, as the field name is always the same
477475* [L. Input unions should be performant for servers][criteria-l]
478- * ❔ Not evaluated
476+ * ✅ O(1)
479477* [M. Existing SDL parsers are backwards compatible with SDL additions][criteria-m]
480478 * 🚫 Parsers will not recognize the `inputunion` keyword
481479* [N. Existing code generated tooling is backwards compatible with Introspection additions][criteria-n]
482- * ❔ Not evaluated
480+ * ✅⚠️
483481* [O. Unconstrained combination of input types to unions][criteria-o]
484482 * ✅ Adding or removing an input type to a union has no extraneous effects on schema design
485483
@@ -583,13 +581,13 @@ inputunion AnimalInput @discriminator(field: "species") =
583581* [ J. A GraphQL schema that supports input unions can be queried by older GraphQL clients] [ criteria-j ]
584582 * ✅ Changes are additive only
585583* [ K. Input unions should be expressed efficiently in the query and on the wire] [ criteria-k ]
586- * ❔ Not evaluated
584+ * ⚠️ Input types that are part of an input union always have to contain the non-null discriminator
587585* [ L. Input unions should be performant for servers] [ criteria-l ]
588- * ❔ Not evaluated
586+ * ✅ O(1)
589587* [ M. Existing SDL parsers are backwards compatible with SDL additions] [ criteria-m ]
590588 * 🚫 Parsers will not recognize the ` inputunion ` keyword
591589* [ N. Existing code generated tooling is backwards compatible with Introspection additions] [ criteria-n ]
592- * ❔ Not evaluated
590+ * ✅⚠️
593591* [ O. Unconstrained combination of input types to unions] [ criteria-o ]
594592 * 🚫 Adding an input type to a union requires that it has the non-null discriminator field
595593 * The input might already have a field with the same name, but a different type
@@ -674,13 +672,13 @@ type Mutation {
674672* [J. A GraphQL schema that supports input unions can be queried by older GraphQL clients][criteria-j]
675673 * ✅ Changes are additive only
676674* [K. Input unions should be expressed efficiently in the query and on the wire][criteria-k]
677- * ❔ Not evaluated
675+ * ✅ No overhead
678676* [L. Input unions should be performant for servers][criteria-l]
679- * ❔ Not evaluated
677+ * ⚠️ O(N of members)
680678* [M. Existing SDL parsers are backwards compatible with SDL additions][criteria-m]
681679 * 🚫 Parsers will not recognize the `inputunion` keyword
682680* [N. Existing code generated tooling is backwards compatible with Introspection additions][criteria-n]
683- * ❔ Not evaluated
681+ * ✅⚠️
684682* [O. Unconstrained combination of input types to unions][criteria-o]
685683 * ❔ Not evaluated
686684
@@ -767,13 +765,13 @@ input DogInput {
767765* [J. A GraphQL schema that supports input unions can be queried by older GraphQL clients][criteria-j]
768766 * ✅ Changes are additive only
769767* [K. Input unions should be expressed efficiently in the query and on the wire][criteria-k]
770- * ❔ Not evaluated
768+ * ✅ No overhead
771769* [L. Input unions should be performant for servers][criteria-l]
772- * ❔ Not evaluated
770+ * ⚠️ O(N of members)
773771* [M. Existing SDL parsers are backwards compatible with SDL additions][criteria-m]
774772 * 🚫 Parsers will not recognize the `inputunion` keyword
775773* [N. Existing code generated tooling is backwards compatible with Introspection additions][criteria-n]
776- * ❔ Not evaluated
774+ * ✅⚠️
777775* [O. Unconstrained combination of input types to unions][criteria-o]
778776 * 🚫 Input types with similar fields may not be able to be combined without breaking changes
779777
@@ -870,18 +868,18 @@ A quick glance at the evaluation results. Remember that passing or failing a spe
870868| -- | -- | -- | -- | -- | -- |
871869| [A ][criteria -a ] 🥇 | ✅ | ✅ | ✅ | ✅ | ✅ |
872870| [B ][criteria -b ] 🥇 | ✅⚠️ | ✅ | ✅ | ✅⚠️ | 🚫 |
873- | [C ][criteria -c ] 🥇 | ✅ | ✅ | 🚫 | ⚠️ | ✅ |
871+ | [C ][criteria -c ] 🥇 | ✅ | ✅⚠️ | 🚫 | ⚠️ | ✅ |
874872| [D ][criteria -d ] 🥇 | ✅ | ✅ | ✅ | ✅ | ✅ |
875873| [E ][criteria -e ] 🥉 | 🚫 | 🚫 | ✅⚠️ | 🚫 | ✅ |
876874| [F ][criteria -f ] 🥉 | ✅⚠️ | ✅⚠️ | ✅ | ⚠️ | ✅ |
877875| [G ][criteria -g ] 🥉 | ❔ | ❔ | ❔ | ❔ | ❔ |
878876| [H ][criteria -h ] 🥉 | ⚠️ | ⚠️ | ✅ | ✅ | ⚠️ |
879- | [I ][criteria -i ] 🥉 | ✅⚠️ | ✅⚠️ | ✅ | ⚠️ | ✅ |
877+ | [I ][criteria -i ] 🥉 | ✅ | ✅ | ✅ | ⚠️ | ✅ |
880878| [J ][criteria -j ] 🥇 | ✅ | ✅ | ✅ | ✅ | ✅ |
881- | [K ][criteria -k ] 🥉 | ❔ | ❔ | ❔ | ❔ | ✅ |
882- | [L ][criteria -l ] 🥉 | ❔ | ❔ | ❔ | ❔ | ✅ |
879+ | [K ][criteria -k ] 🥉 | ✅ | ⚠️ | ✅ | ✅ | ✅ |
880+ | [L ][criteria -l ] 🥉 | ✅ | ✅ | ⚠️ | ⚠️ | ✅ |
883881| [M ][criteria -m ] 🥈 | 🚫 | 🚫 | 🚫 | 🚫 | ✅ |
884- | [N ][criteria -n ] 🥈 | ❔ | ❔ | ❔ | ❔ | ✅ |
882+ | [N ][criteria -n ] 🥈 | ✅⚠️ | ✅⚠️ | ✅⚠️ | ✅⚠️ | ✅ |
885883| [O ][criteria -o ] 🥈 | ✅️ | 🚫️ | ❔ | 🚫 | ✅ |
886884
887885[criteria -a ]: #-a-graphql-should-contain-a-polymorphic-input-type
0 commit comments