@@ -736,6 +736,40 @@ The depth-first-search order of the field groups produced by {CollectFields()}
736
736
is maintained through execution, ensuring that fields appear in the executed
737
737
response in a stable and predictable order.
738
738
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
+
739
773
CollectFields(objectType, selectionSet, variableValues, deferUsage,
740
774
visitedFragments):
741
775
@@ -843,6 +877,10 @@ DoesFragmentTypeApply(objectType, fragmentType):
843
877
Note: The steps in {CollectFields()} evaluating the ` @skip ` and ` @include `
844
878
directives may be applied in either order since they apply commutatively.
845
879
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
+
846
884
### Field Plan Generation
847
885
848
886
BuildFieldPlan(originalGroupedFieldSet, parentDeferUsages):
0 commit comments