From 03ba25598f7520c05b3dfb27697a84de76829c2e Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Wed, 27 Mar 2024 14:38:26 +0100 Subject: [PATCH] conciser validation --- spec/Section 5 -- Validation.md | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 44183b4ef..6c1c3e4b7 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -579,8 +579,6 @@ fragment conflictingDifferingResponses on Pet { Fragment spread arguments can also cause fields to fail to merge. -While the following is valid: - ```graphql example fragment commandFragment($command: DogCommand!) on Dog { doesKnowCommand(dogCommand: $command) @@ -588,39 +586,25 @@ fragment commandFragment($command: DogCommand!) on Dog { fragment potentiallyConflictingArguments( $commandOne: DogCommand! - $commandTwo: DogCommand! ) on Dog { ...commandFragment(command: $commandOne) ...commandFragment(command: $commandTwo) } fragment safeFragmentArguments on Dog { - ...potentiallyConflictingArguments(commandOne: SIT, commandTwo: SIT) -} -``` - -it is only valid because `safeFragmentArguments` uses -`potentiallyConflictingArguments` with the same value for the fragment-defined -variables `commandOne` and `commandTwo`. Therefore `commandFragment` resolves -`doesKnowCommand`'s `dogCommand` argument value to `SIT` in both cases. - -However, by changing the fragment spread argument values: - -```graphql counter-example -fragment conflictingFragmentArguments on Dog { ...potentiallyConflictingArguments(commandOne: SIT, commandTwo: DOWN) } ``` -the response will have two conflicting versions of the `doesKnowCommand` -fragment that cannot merge. - If two fragment spreads with the same name supply different argument values, their fields will not be able to merge. In this case, validation fails because the fragment spread `...commandFragment(command: SIT)` and `...commandFragment(command: DOWN)` are part of the visited selections that will be merged. +If both of these spreads would have `$commandOne` or `$commandTwo` as the argument-value, +it would be allowed as we can be sure that we'd resolve identical fields. + ### Leaf Field Selections **Formal Specification**