@@ -388,8 +388,10 @@ executionMode):
388
388
### Field Collection
389
389
390
390
Before execution, each _ selection set_ is converted to a _ collected fields map_
391
- by calling {CollectFields()}. This ensures all fields with the same response
392
- name, including those in referenced fragments, are executed at the same time.
391
+ by calling {CollectFields()} by collecting all fields with the same response
392
+ name, including those in referenced fragments, into an individual _ field set_ .
393
+ This ensures that multiple references to fields with the same response name will
394
+ only be executed once.
393
395
394
396
:: A _ collected fields map_ is an ordered map where each entry is a _ response
395
397
name_ and its associated _ field set_ . A _ collected fields map_ may be produced
@@ -558,16 +560,12 @@ name_.
558
560
559
561
### Executing Collected Fields
560
562
561
- The {CollectFields()} and {CollectSubfields()} algorithms transitively collect
562
- the field selections from a _ selection set_ or the associated selection sets of
563
- a _ field set_ respectively, and split them into sets by their _ response name_ to
564
- produce a _ collected fields map_ .
565
-
566
563
To execute a _ collected fields map_ , the object type being evaluated and the
567
564
runtime value need to be known, as well as the runtime values for any variables.
568
565
569
- Each entry in the collected fields map represents a _ response name_ which
570
- produces an entry into a result map.
566
+ Execution will recursively resolve and complete the value of every entry in the
567
+ collected fields map, producing an entry in the result map with the same
568
+ _ response name_ key.
571
569
572
570
ExecuteCollectedFields(collectedFieldsMap, objectType, objectValue,
573
571
variableValues):
@@ -608,7 +606,7 @@ about this behavior.
608
606
609
607
### Normal and Serial Execution
610
608
611
- Normally the executor can execute the entries in a collected fields map in
609
+ Normally the executor can execute the entries in a _ collected fields map _ in
612
610
whatever order it chooses (normally in parallel). Because the resolution of
613
611
fields other than top-level mutation fields must always be side effect-free and
614
612
idempotent, the execution order must not affect the result, and hence the
@@ -708,11 +706,11 @@ A correct executor must generate the following result for that _selection set_:
708
706
709
707
## Executing Fields
710
708
711
- Each field from the _ collected fields map _ that is defined on the selected
712
- objectType will result in an entry in the result map . Field execution first
713
- coerces any provided argument values, then resolves a value for the field, and
714
- finally completes that value either by recursively executing another selection
715
- set or coercing a scalar value.
709
+ Each entry in a result map is the result of executing a field on an object type
710
+ selected by the name of that field in a _ collected fields map _ . Field execution
711
+ first coerces any provided argument values, then resolves a value for the field,
712
+ and finally completes that value either by recursively executing another
713
+ selection set or coercing a scalar value.
716
714
717
715
ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
718
716
@@ -812,7 +810,8 @@ returned by {resolver} may itself be retrieved asynchronously.
812
810
813
811
After resolving the value for a field, it is completed by ensuring it adheres to
814
812
the expected return type. If the return type is another Object type, then the
815
- field execution process continues recursively.
813
+ field execution process continues recursively by collecting and executing
814
+ subfields.
816
815
817
816
CompleteValue(fieldType, fields, result, variableValues):
818
817
0 commit comments