@@ -418,8 +418,14 @@ fragment directFieldSelectionOnUnion on CatOrDog {
418
418
419
419
FieldsInSetCanMerge(set):
420
420
421
+ - Let {visitedSelections} be the selections in {set} including visiting
422
+ fragments and inline fragments an applying any supplied fragment arguments.
423
+ - Let {spreadsForName} be the set of fragment spreads with a given name in
424
+ {visitedSelections}.
425
+ - Given each pair of members {spreadA} and {spreadB} in {spreadsForName}:
426
+ - {spreadA} and {spreadB} must have identical sets of arguments.
421
427
- Let {fieldsForName} be the set of selections with a given response name in
422
- {set} including visiting fragments and inline fragments .
428
+ {visitedSelections} .
423
429
- Given each pair of members {fieldA} and {fieldB} in {fieldsForName}:
424
430
- {SameResponseShape(fieldA, fieldB)} must be true.
425
431
- If the parent types of {fieldA} and {fieldB} are equal or if either is not
@@ -605,14 +611,14 @@ fragment conflictingFragmentArguments on Dog {
605
611
}
606
612
```
607
613
608
- the response will have two conflicting versions of the ` doesKnowCommand ` that
609
- cannot merge.
614
+ the response will have two conflicting versions of the ` doesKnowCommand `
615
+ fragment that cannot merge.
610
616
611
- One strategy to resolving field conflicts caused by duplicated fragment spreads
612
- is to short-circuit when two fragment spreads with the same name are found to be
613
- merging with different argument values. In this case, validation could short
614
- circuit when ` commandFragment(command: SIT ) ` is merged with
615
- ` commandFragment(command: DOWN) ` .
617
+ If two fragment spreads with the same name supply different argument values,
618
+ their fields will not be able to merge. In this case, validation fails because
619
+ the fragment spread ` ...commandFragment(command: SIT) ` and
620
+ ` ... commandFragment(command: DOWN )` are part of the visited selections that will
621
+ be merged .
616
622
617
623
### Leaf Field Selections
618
624
@@ -729,7 +735,7 @@ fragment usesFragmentArg on Dog {
729
735
}
730
736
```
731
737
732
- the following is invalid since ` command: ` is not defined on
738
+ The following is invalid since ` command ` is not defined on
733
739
` Dog.doesKnowCommand ` .
734
740
735
741
``` graphql counter-example
@@ -738,7 +744,7 @@ fragment invalidArgName on Dog {
738
744
}
739
745
```
740
746
741
- and this is also invalid as ` $ dogCommand` is not defined on fragment
747
+ and this is also invalid as the argument ` dogCommand ` is not defined on fragment
742
748
` withFragmentArg ` .
743
749
744
750
``` graphql counter-example
@@ -1892,7 +1898,7 @@ fragment isHouseTrainedWithoutVariableFragment on Dog {
1892
1898
```
1893
1899
1894
1900
Fragment arguments can shadow operation variables: fragments that use an
1895
- argument are not using the operation defined variable of the same name.
1901
+ argument are not using the operation- defined variable of the same name.
1896
1902
1897
1903
Likewise, it would be invalid if the variable was shadowed by a fragment
1898
1904
argument:
@@ -1911,7 +1917,7 @@ fragment shadowedVariableFragment($atOtherHomes: Boolean) on Dog {
1911
1917
1912
1918
because
1913
1919
{$atOtherHomes} is only referenced in a fragment that defines it as a
1914
- locally scoped argument, the operation defined {$atOtherHomes}
1920
+ locally scoped argument, the operation- defined {$atOtherHomes}
1915
1921
variable is never used.
1916
1922
1917
1923
All operations in a document must use all of their variables.
@@ -1951,11 +1957,10 @@ variable.
1951
1957
** Explanatory Text**
1952
1958
1953
1959
All arguments defined by a fragment must be used in that same fragment. Because
1954
- fragment arguments are scoped to the fragment they're defined on, if the
1955
- fragment does not contain a variable with the same name as the argument, then
1956
- the argument is superfluous.
1960
+ fragment arguments are scoped to the fragment they are defined on, if the
1961
+ fragment does not use the argument, then the argument is superfluous.
1957
1962
1958
- For example the following is invalid:
1963
+ For example, the following is invalid:
1959
1964
1960
1965
``` graphql counter-example
1961
1966
query queryWithFragmentArgUnused ($atOtherHomes : Boolean ) {
0 commit comments