Skip to content

Commit 74bfb43

Browse files
committed
add info re: data structures
1 parent 81a9353 commit 74bfb43

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

spec/Section 6 -- Execution.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,40 @@ The depth-first-search order of the field groups produced by {CollectFields()}
736736
is maintained through execution, ensuring that fields appear in the executed
737737
response in a stable and predictable order.
738738

739+
The {CollectFields()} algorithm makes use of the following data types:
740+
741+
Defer Usage Records are unordered maps representing the usage of a `@defer`
742+
directive within a given operation. Defer Usages are "abstract" in that they
743+
include information about the `@defer` directive from the AST of the GraphQL
744+
document. A single Defer Usage may be used to create many "concrete" Delivery
745+
Groups when a `@defer` is included within a list type.
746+
747+
Defer Usages contain the following information:
748+
749+
- {label}: the `label` argument provided by the given `@defer` directive, if
750+
any, otherwise {undefined}.
751+
- {parentDeferUsage}: a Defer Usage corresponding to the `@defer` directive
752+
enclosing this `@defer` directive, if any, otherwise {undefined}.
753+
754+
The {parentDeferUsage} entry is used to build distinct Execution Groups as
755+
discussed within the Field Plan Generation section below.
756+
757+
Field Details Records are unordered maps containing the following entries:
758+
759+
- {field}: the Field selection.
760+
- {deferUsage}: the Defer Usage enclosing the selection, if any, otherwise
761+
{undefined}.
762+
763+
A Grouped Field Set is an ordered map of keys to lists of Field Details. The
764+
keys are the same as that of the response, the alias for the field, if defined,
765+
otherwise the field name.
766+
767+
The {CollectFields()} algorithm returns:
768+
769+
- {groupedFieldSet}: the Grouped Field Set for the fields in the selection set.
770+
- {newDeferUsages}: a list of new Defer Usages encountered during this field
771+
collection.
772+
739773
CollectFields(objectType, selectionSet, variableValues, deferUsage,
740774
visitedFragments):
741775

@@ -843,6 +877,10 @@ DoesFragmentTypeApply(objectType, fragmentType):
843877
Note: The steps in {CollectFields()} evaluating the `@skip` and `@include`
844878
directives may be applied in either order since they apply commutatively.
845879

880+
Note: When completing a List field, the {CollectFields} algorithm is invoked
881+
with the same arguments for each element of the list. GraphQL Services may
882+
choose to memoize their implementations of {CollectFields}.
883+
846884
### Field Plan Generation
847885

848886
BuildFieldPlan(originalGroupedFieldSet, parentDeferUsages):

0 commit comments

Comments
 (0)