@@ -479,17 +479,28 @@ The depth-first-search order of the field groups produced by {CollectFields()}
479
479
is maintained through execution, ensuring that fields appear in the executed
480
480
response in a stable and predictable order.
481
481
482
+ When {CollectFields()} is used during validation (see for example the
483
+ [ single root field] ( #sec-Single-root-field ) subscription operation validation
484
+ rule), the runtime value for {variableValues} will not be available - in this
485
+ case we set {variableValues} to {null} and forbid the use of the ` @skip ` and
486
+ ` @include ` directives. During execution, {variableValues} will always be
487
+ non-null.
488
+
482
489
CollectFields(objectType, selectionSet, variableValues, visitedFragments):
483
490
484
491
* If {visitedFragments} is not provided, initialize it to the empty set.
485
492
* Initialize {groupedFields} to an empty ordered map of lists.
486
493
* For each {selection} in {selectionSet}:
487
- * If {selection} provides the directive ` @skip ` , let {skipDirective} be that directive.
488
- * If {skipDirective}'s {if} argument is {true} or is a variable in {variableValues} with the value {true}, continue with the next
489
- {selection} in {selectionSet}.
490
- * If {selection} provides the directive ` @include ` , let {includeDirective} be that directive.
491
- * If {includeDirective}'s {if} argument is not {true} and is not a variable in {variableValues} with the value {true}, continue with the next
492
- {selection} in {selectionSet}.
494
+ * If {variableValues} is {null}:
495
+ * {selection} must not provide the ` @skip ` directive.
496
+ * {selection} must not provide the ` @include ` directive.
497
+ * Otherwise:
498
+ * If {selection} provides the directive ` @skip ` , let {skipDirective} be that directive.
499
+ * If {skipDirective}'s {if} argument is {true} or is a variable in {variableValues} with the value {true}, continue with the next
500
+ {selection} in {selectionSet}.
501
+ * If {selection} provides the directive ` @include ` , let {includeDirective} be that directive.
502
+ * If {includeDirective}'s {if} argument is not {true} and is not a variable in {variableValues} with the value {true}, continue with the next
503
+ {selection} in {selectionSet}.
493
504
* If {selection} is a {Field}:
494
505
* Let {responseKey} be the response key of {selection} (the alias if defined, otherwise the field name).
495
506
* Let {groupForResponseKey} be the list in {groupedFields} for
0 commit comments