@@ -727,6 +727,9 @@ fragment conflictingDifferingResponses on Pet {
727727
728728Fragment spread arguments can also cause fields to fail to merge.
729729
730+ In the following, the arguments to ` commandFragment ` reference different
731+ variables and so cannot merge:
732+
730733``` graphql counter-example
731734fragment commandFragment ($command : DogCommand ! ) on Dog {
732735 doesKnowCommand (dogCommand : $command )
@@ -747,32 +750,24 @@ query {
747750}
748751```
749752
750- If two fragment spreads with the same name, and hence the same selection, supply
751- different argument values, their fields will not be able to merge. In this case,
752- validation fails because the fragment spread ` ...commandFragment(command: SIT) `
753- and ` ...commandFragment(command: DOWN) ` are part of the visited selections that
754- will be merged.
755-
756- If both of these spreads had used the same value for the argument value, it
757- would be allowed as we can be sure that we would resolve identical fields.
758- Spreads that use different variables that would always resolve to the same value
759- are also valid. For example, the following is valid:
753+ Though the fragment is referenced consistently as
754+ ` ...commandFragment(command: $command) ` in the following, the position in which
755+ the ` $command ` variable is defined for each reference differs, and thus the
756+ arguments do not match:
760757
761- ``` graphql example
758+ ``` graphql counter- example
762759fragment commandFragment ($command : DogCommand ! ) on Dog {
763760 doesKnowCommand (dogCommand : $command )
764761}
765762
766- fragment noConflictWhenPassedOperationCommand (
767- $fragmentCommand : DogCommand !
768- ) on Dog {
769- ... commandFragment (command : $operationCommand )
770- ... commandFragment (command : $fragmentCommand )
763+ fragment otherFragment (command : DogCommand ! ) on Dog {
764+ ... commandFragment (command : $command )
771765}
772766
773- query ( $operationCommand : DogCommand ! ) {
767+ query KnowsCommand ( $command : DogCommand ! ) {
774768 pet {
775- ... noConflictWhenPassedOperationCommand (fragmentCommand : $operationCommand )
769+ ... commandFragment (command : $command )
770+ ... otherFragment (command : DOWN )
776771 }
777772}
778773```
0 commit comments