@@ -377,7 +377,7 @@ executionMode):
377
377
378
378
- Let {groupedFieldSet} be the result of {CollectFields(objectType,
379
379
selectionSet, variableValues)}.
380
- - Let {data} be the result of running {ExecuteGroupedFieldSet (groupedFieldSet,
380
+ - Let {data} be the result of running {ExecuteCollectedFields (groupedFieldSet,
381
381
objectType, initialValue, variableValues)} _ serially_ if {executionMode} is
382
382
{"serial"}, otherwise _ normally_ (allowing parallelization)).
383
383
- Let {errors} be the list of all _ execution error_ raised while executing the
@@ -386,17 +386,26 @@ executionMode):
386
386
387
387
### Field Collection
388
388
389
- Before execution, the _ selection set_ is converted to a _ grouped field set_ by
390
- calling {CollectFields()}. This ensures all fields with the same response name,
391
- including those in referenced fragments, are executed at the same time.
389
+ Before execution, the _ root selection set_ is converted to a _ grouped field set_
390
+ by calling {CollectFields()}. This ensures all fields with the same response
391
+ name, including those in referenced fragments, are executed at the same time.
392
392
393
- :: A _ grouped field set_ is a map where each entry is a _ response name_ and a
394
- list of selected fields that share that _ response name_ (the field alias if
395
- defined, otherwise the field's name).
393
+ :: A _ grouped field set_ is a map where each entry is a _ response name_ and its
394
+ associated _ field set_ . A _ grouped field set_ may be produced from a selection
395
+ set via {CollectFields()} or from the selection sets of a _ field set_ via
396
+ {CollectSubfields()}.
396
397
397
- As an example, collecting the fields of this selection set would result in a
398
- grouped field set with two entries, ` "a" ` and ` "b" ` , with two instances of the
399
- field ` a ` and one of field ` b ` :
398
+ :: A _ field set_ is a list of selected fields that share the same _ response
399
+ name_ (the field alias if defined, otherwise the field's name).
400
+
401
+ Note: The order of field selections in a _ field set_ is significant, hence the
402
+ algorithms in this specification model it as a list. Any later duplicated field
403
+ selections in a field set will not impact its interpretation, so using an
404
+ ordered set would yield equivalent results.
405
+
406
+ As an example, collecting the fields of this query's selection set would result
407
+ in a grouped field set with two entries, ` "a" ` and ` "b" ` , with two instances of
408
+ the field ` a ` and one of field ` b ` :
400
409
401
410
``` graphql example
402
411
{
@@ -542,7 +551,12 @@ CollectSubfields(objectType, fields, variableValues):
542
551
Note: All the {fields} passed to {CollectSubfields()} share the same _ response
543
552
name_ .
544
553
545
- ### Executing a Grouped Field Set
554
+ ### Executing Collected Fields
555
+
556
+ The {CollectFields()} and {CollectSubfields()} algorithms collect together all
557
+ of the field selections from a _ selection set_ or the nested selection sets of a
558
+ _ field set_ respectively, and split them into groups by their _ response name_ to
559
+ produce a _ grouped field set_ .
546
560
547
561
To execute a _ grouped field set_ , the object value being evaluated and the
548
562
object type need to be known, as well as whether it must be executed serially,
@@ -552,7 +566,7 @@ or may be executed in parallel (see
552
566
Each entry in the grouped field set represents a _ response name_ which produces
553
567
an entry into a result map.
554
568
555
- ExecuteGroupedFieldSet (groupedFieldSet, objectType, objectValue,
569
+ ExecuteCollectedFields (groupedFieldSet, objectType, objectValue,
556
570
variableValues):
557
571
558
572
- Initialize {resultMap} to an empty ordered map.
@@ -577,7 +591,7 @@ section.
577
591
<!-- Legacy link, this section was previously titled "Errors and Non-Null Fields" -->
578
592
</a >
579
593
580
- If during {ExecuteGroupedFieldSet ()} a _ response position_ with a non-null type
594
+ If during {ExecuteCollectedFields ()} a _ response position_ with a non-null type
581
595
raises an _ execution error_ then that error must propagate to the parent
582
596
response position (the entire selection set in the case of a field, or the
583
597
entire list in the case of a list position), either resolving to {null} if
@@ -820,7 +834,7 @@ CompleteValue(fieldType, fields, result, variableValues):
820
834
- Let {objectType} be {ResolveAbstractType(fieldType, result)}.
821
835
- Let {groupedFieldSet} be the result of calling {CollectSubfields(objectType,
822
836
fields, variableValues)}.
823
- - Return the result of evaluating {ExecuteGroupedFieldSet (groupedFieldSet,
837
+ - Return the result of evaluating {ExecuteCollectedFields (groupedFieldSet,
824
838
objectType, result, variableValues)} _ normally_ (allowing for
825
839
parallelization).
826
840
0 commit comments