Skip to content

Commit 276230f

Browse files
committed
Correct algorithm and provide clarifying note
1 parent 20fb2f7 commit 276230f

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

spec/Section 5 -- Validation.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,13 @@ fragment directFieldSelectionOnUnion on CatOrDog {
556556

557557
FieldsInSetCanMerge(set):
558558

559-
- Let {visitedSelections} be the selections in {set} including visiting fields,
560-
fragment-spreads and inline fragments.
561-
- Let {spreadsForName} be the set of fragment spreads with a given name in
562-
{visitedSelections}.
563-
- For each {spreadsForName} as {name} and {spreads}:
564-
- Each entry in {spreads} must have identical sets of arguments to each other
565-
entry in {spreads}.
566-
- Let {fieldsForName} be the set of field selections with a given response name
567-
in {visitedSelections}.
559+
- Let {spreadsForFragment} be the set of fragment spreads for a given named
560+
fragment in {set} including visiting fragments and inline fragments.
561+
- Given each pair of distinct members {spreadA} and {spreadB} in
562+
{spreadsForFragment}:
563+
- {spreadA} and {spreadB} must have identical sets of arguments.
564+
- Let {fieldsForName} be the set of selections with a given _response name_ in
565+
{set} including visiting fragments and inline fragments.
568566
- Given each pair of distinct members {fieldA} and {fieldB} in {fieldsForName}:
569567
- {SameResponseShape(fieldA, fieldB)} must be true.
570568
- If the parent types of {fieldA} and {fieldB} are equal or if either is not
@@ -575,6 +573,13 @@ FieldsInSetCanMerge(set):
575573
the selection set of {fieldB}.
576574
- {FieldsInSetCanMerge(mergedSet)} must be true.
577575

576+
Note: When checking if two fragment spreads or two field selections have
577+
"identical sets of arguments", it is necessary to check both the name of any
578+
variables referenced and also where the variable is defined. For example, if
579+
each selection references the variable `$size`, then `$size` must either be an
580+
operation variable for both references, or must refer to the same fragment
581+
variable definition for both references.
582+
578583
SameResponseShape(fieldA, fieldB):
579584

580585
- Let {typeA} be the return type of {fieldA}.

0 commit comments

Comments
 (0)