Skip to content

Commit 4571da9

Browse files
committed
add info re: data structures
1 parent 313aaa6 commit 4571da9

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
@@ -733,6 +733,40 @@ The depth-first-search order of the field groups produced by {CollectFields()}
733733
is maintained through execution, ensuring that fields appear in the executed
734734
response in a stable and predictable order.
735735

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

@@ -840,6 +874,10 @@ DoesFragmentTypeApply(objectType, fragmentType):
840874
Note: The steps in {CollectFields()} evaluating the `@skip` and `@include`
841875
directives may be applied in either order since they apply commutatively.
842876

877+
Note: When completing a List field, the {CollectFields} algorithm is invoked
878+
with the same arguments for each element of the list. GraphQL Services may
879+
choose to memoize their implementations of {CollectFields}.
880+
843881
### Field Plan Generation
844882

845883
BuildFieldPlan(originalGroupedFieldSet, parentDeferUsages):

0 commit comments

Comments
 (0)