@@ -579,48 +579,32 @@ fragment conflictingDifferingResponses on Pet {
579
579
580
580
Fragment spread arguments can also cause fields to fail to merge.
581
581
582
- While the following is valid:
583
-
584
582
``` graphql example
585
583
fragment commandFragment ($command : DogCommand ! ) on Dog {
586
584
doesKnowCommand (dogCommand : $command )
587
585
}
588
586
589
587
fragment potentiallyConflictingArguments (
590
588
$commandOne : DogCommand !
591
- $commandTwo : DogCommand !
592
589
) on Dog {
593
590
... commandFragment (command : $commandOne )
594
591
... commandFragment (command : $commandTwo )
595
592
}
596
593
597
594
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 {
611
595
... potentiallyConflictingArguments (commandOne : SIT , commandTwo : DOWN )
612
596
}
613
597
```
614
598
615
- the response will have two conflicting versions of the ` doesKnowCommand `
616
- fragment that cannot merge.
617
-
618
599
If two fragment spreads with the same name supply different argument values,
619
600
their fields will not be able to merge. In this case, validation fails because
620
601
the fragment spread ` ...commandFragment(command: SIT) ` and
621
602
` ...commandFragment(command: DOWN) ` are part of the visited selections that will
622
603
be merged.
623
604
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
+
624
608
### Leaf Field Selections
625
609
626
610
** Formal Specification**
0 commit comments