@@ -733,6 +733,40 @@ The depth-first-search order of the field groups produced by {CollectFields()}
733
733
is maintained through execution, ensuring that fields appear in the executed
734
734
response in a stable and predictable order.
735
735
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
+
736
770
CollectFields(objectType, selectionSet, variableValues, deferUsage,
737
771
visitedFragments):
738
772
@@ -840,6 +874,10 @@ DoesFragmentTypeApply(objectType, fragmentType):
840
874
Note: The steps in {CollectFields()} evaluating the ` @skip ` and ` @include `
841
875
directives may be applied in either order since they apply commutatively.
842
876
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
+
843
881
### Field Plan Generation
844
882
845
883
BuildFieldPlan(originalGroupedFieldSet, parentDeferUsages):
0 commit comments