Skip to content

Commit 03ba255

Browse files
committed
conciser validation
1 parent 7cad383 commit 03ba255

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

spec/Section 5 -- Validation.md

+3-19
Original file line numberDiff line numberDiff line change
@@ -579,48 +579,32 @@ fragment conflictingDifferingResponses on Pet {
579579

580580
Fragment spread arguments can also cause fields to fail to merge.
581581

582-
While the following is valid:
583-
584582
```graphql example
585583
fragment commandFragment($command: DogCommand!) on Dog {
586584
doesKnowCommand(dogCommand: $command)
587585
}
588586

589587
fragment potentiallyConflictingArguments(
590588
$commandOne: DogCommand!
591-
$commandTwo: DogCommand!
592589
) on Dog {
593590
...commandFragment(command: $commandOne)
594591
...commandFragment(command: $commandTwo)
595592
}
596593

597594
fragment safeFragmentArguments on Dog {
598-
...potentiallyConflictingArguments(commandOne: SIT, commandTwo: SIT)
599-
}
600-
```
601-
602-
it is only valid because `safeFragmentArguments` uses
603-
`potentiallyConflictingArguments` with the same value for the fragment-defined
604-
variables `commandOne` and `commandTwo`. Therefore `commandFragment` resolves
605-
`doesKnowCommand`'s `dogCommand` argument value to `SIT` in both cases.
606-
607-
However, by changing the fragment spread argument values:
608-
609-
```graphql counter-example
610-
fragment conflictingFragmentArguments on Dog {
611595
...potentiallyConflictingArguments(commandOne: SIT, commandTwo: DOWN)
612596
}
613597
```
614598

615-
the response will have two conflicting versions of the `doesKnowCommand`
616-
fragment that cannot merge.
617-
618599
If two fragment spreads with the same name supply different argument values,
619600
their fields will not be able to merge. In this case, validation fails because
620601
the fragment spread `...commandFragment(command: SIT)` and
621602
`...commandFragment(command: DOWN)` are part of the visited selections that will
622603
be merged.
623604

605+
If both of these spreads would have `$commandOne` or `$commandTwo` as the argument-value,
606+
it would be allowed as we can be sure that we'd resolve identical fields.
607+
624608
### Leaf Field Selections
625609

626610
**Formal Specification**

0 commit comments

Comments
 (0)