Skip to content

Commit e753162

Browse files
committed
Use the term fieldSet in the algorithms
1 parent c7532d1 commit e753162

File tree

1 file changed

+36
-38
lines changed

1 file changed

+36
-38
lines changed

spec/Section 6 -- Execution.md

+36-38
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,10 @@ CreateSourceEventStream(subscription, schema, variableValues, initialValue):
271271
- Let {groupedFieldSet} be the result of {CollectFields(subscriptionType,
272272
selectionSet, variableValues)}.
273273
- If {groupedFieldSet} does not have exactly one entry, raise a _request error_.
274-
- Let {fields} be the value of the first entry in {groupedFieldSet}.
275-
- Let {fieldName} be the name of the first entry in {fields}. Note: This value
274+
- Let {fieldSet} be the value of the first entry in {groupedFieldSet}.
275+
- Let {fieldName} be the name of the first entry in {fieldSet}. Note: This value
276276
is unaffected if an alias is used.
277-
- Let {field} be the first entry in {fields}.
277+
- Let {field} be the first entry in {fieldSet}.
278278
- Let {argumentValues} be the result of {CoerceArgumentValues(subscriptionType,
279279
field, variableValues)}.
280280
- Let {sourceStream} be the result of running
@@ -430,7 +430,7 @@ response in a stable and predictable order.
430430
CollectFields(objectType, selectionSet, variableValues, visitedFragments):
431431

432432
- If {visitedFragments} is not provided, initialize it to the empty set.
433-
- Initialize {groupedFields} to an empty ordered map of lists.
433+
- Initialize {groupedFieldSet} to an empty ordered map of lists.
434434
- For each {selection} in {selectionSet}:
435435
- If {selection} provides the directive `@skip`, let {skipDirective} be that
436436
directive.
@@ -445,9 +445,9 @@ CollectFields(objectType, selectionSet, variableValues, visitedFragments):
445445
- If {selection} is a {Field}:
446446
- Let {responseName} be the _response name_ of {selection} (the alias if
447447
defined, otherwise the field name).
448-
- Let {groupForResponseName} be the list in {groupedFields} for
449-
{responseName}; if no such list exists, create it as an empty list.
450-
- Append {selection} to the {groupForResponseName}.
448+
- Let {fieldSet} be the list in {groupedFieldSet} for {responseName}; if no
449+
such list exists, create it as an empty list.
450+
- Append {selection} to {fieldSet}.
451451
- If {selection} is a {FragmentSpread}:
452452
- Let {fragmentSpreadName} be the name of {selection}.
453453
- If {fragmentSpreadName} is in {visitedFragments}, continue with the next
@@ -464,12 +464,11 @@ CollectFields(objectType, selectionSet, variableValues, visitedFragments):
464464
- Let {fragmentGroupedFieldSet} be the result of calling
465465
{CollectFields(objectType, fragmentSelectionSet, variableValues,
466466
visitedFragments)}.
467-
- For each {fragmentGroup} in {fragmentGroupedFieldSet}:
468-
- Let {responseName} be the response name shared by all fields in
469-
{fragmentGroup}.
470-
- Let {groupForResponseName} be the list in {groupedFields} for
471-
{responseName}; if no such list exists, create it as an empty list.
472-
- Append all items in {fragmentGroup} to {groupForResponseName}.
467+
- For each {fragmentGroupedFieldSet} as {responseName} and
468+
{fragmentFieldSet}:
469+
- Let {fieldSet} be the list in {groupedFieldSet} for {responseName}; if
470+
no such list exists, create it as an empty list.
471+
- Append all fields in {fragmentFieldSet} to {fieldSet}.
473472
- If {selection} is an {InlineFragment}:
474473
- Let {fragmentType} be the type condition on {selection}.
475474
- If {fragmentType} is not {null} and {DoesFragmentTypeApply(objectType,
@@ -479,13 +478,12 @@ CollectFields(objectType, selectionSet, variableValues, visitedFragments):
479478
- Let {fragmentGroupedFieldSet} be the result of calling
480479
{CollectFields(objectType, fragmentSelectionSet, variableValues,
481480
visitedFragments)}.
482-
- For each {fragmentGroup} in {fragmentGroupedFieldSet}:
483-
- Let {responseName} be the response name shared by all fields in
484-
{fragmentGroup}.
485-
- Let {groupForResponseName} be the list in {groupedFields} for
486-
{responseName}; if no such list exists, create it as an empty list.
487-
- Append all items in {fragmentGroup} to {groupForResponseName}.
488-
- Return {groupedFields}.
481+
- For each {fragmentGroupedFieldSet} as {responseName} and
482+
{fragmentFieldSet}:
483+
- Let {fieldSet} be the list in {groupedFieldSet} for {responseName}; if
484+
no such list exists, create it as an empty list.
485+
- Append all fields in {fragmentFieldSet} to {fieldSet}.
486+
- Return {groupedFieldSet}.
489487

490488
DoesFragmentTypeApply(objectType, fragmentType):
491489

@@ -534,22 +532,22 @@ After resolving the value for field `"a"`, the following multiple selection sets
534532
are merged together so `"subfield1"` and `"subfield2"` are resolved in the same
535533
phase with the same value.
536534

537-
CollectSubfields(objectType, fields, variableValues):
535+
CollectSubfields(objectType, fieldSet, variableValues):
538536

539537
- Let {groupedFieldSet} be an empty map.
540-
- For each {field} in {fields}:
538+
- For each {field} in {fieldSet}:
541539
- Let {fieldSelectionSet} be the selection set of {field}.
542540
- If {fieldSelectionSet} is null or empty, continue to the next field.
543541
- Let {fieldGroupedFieldSet} be the result of {CollectFields(objectType,
544542
fieldSelectionSet, variableValues)}.
545543
- For each {fieldGroupedFieldSet} as {responseName} and {subfields}:
546-
- Let {groupForResponseName} be the list in {groupedFieldSet} for
547-
{responseName}; if no such list exists, create it as an empty list.
548-
- Append all fields in {subfields} to {groupForResponseName}.
544+
- Let {fieldSet} be the list in {groupedFieldSet} for {responseName}; if no
545+
such list exists, create it as an empty list.
546+
- Append all fields in {subfields} to {fieldSet}.
549547
- Return {groupedFieldSet}.
550548

551-
Note: All the {fields} passed to {CollectSubfields()} share the same _response
552-
name_.
549+
Note: The {fieldSet} passed to {CollectSubfields()} is a _field set_, thus they
550+
share the same _response name_.
553551

554552
### Executing Collected Fields
555553

@@ -570,14 +568,14 @@ ExecuteCollectedFields(groupedFieldSet, objectType, objectValue,
570568
variableValues):
571569

572570
- Initialize {resultMap} to an empty ordered map.
573-
- For each {groupedFieldSet} as {responseName} and {fields}:
574-
- Let {fieldName} be the name of the first entry in {fields}. Note: This value
575-
is unaffected if an alias is used.
571+
- For each {groupedFieldSet} as {responseName} and {fieldSet}:
572+
- Let {fieldName} be the name of the first entry in {fieldSet}. Note: This
573+
value is unaffected if an alias is used.
576574
- Let {fieldType} be the return type defined for the field {fieldName} of
577575
{objectType}.
578576
- If {fieldType} is defined:
579577
- Let {responseValue} be {ExecuteField(objectType, objectValue, fieldType,
580-
fields, variableValues)}.
578+
fieldSet, variableValues)}.
581579
- Set {responseValue} as the value for {responseName} in {resultMap}.
582580
- Return {resultMap}.
583581

@@ -709,15 +707,15 @@ coerces any provided argument values, then resolves a value for the field, and
709707
finally completes that value either by recursively executing another selection
710708
set or coercing a scalar value.
711709

712-
ExecuteField(objectType, objectValue, fieldType, fields, variableValues):
710+
ExecuteField(objectType, objectValue, fieldType, fieldSet, variableValues):
713711

714-
- Let {field} be the first entry in {fields}.
712+
- Let {field} be the first entry in {fieldSet}.
715713
- Let {fieldName} be the field name of {field}.
716714
- Let {argumentValues} be the result of {CoerceArgumentValues(objectType, field,
717715
variableValues)}.
718716
- Let {resolvedValue} be {ResolveFieldValue(objectType, objectValue, fieldName,
719717
argumentValues)}.
720-
- Return the result of {CompleteValue(fieldType, fields, resolvedValue,
718+
- Return the result of {CompleteValue(fieldType, fieldSet, resolvedValue,
721719
variableValues)}.
722720

723721
### Coercing Field Arguments
@@ -809,12 +807,12 @@ After resolving the value for a field, it is completed by ensuring it adheres to
809807
the expected return type. If the return type is another Object type, then the
810808
field execution process continues recursively.
811809

812-
CompleteValue(fieldType, fields, result, variableValues):
810+
CompleteValue(fieldType, fieldSet, result, variableValues):
813811

814812
- If the {fieldType} is a Non-Null type:
815813
- Let {innerType} be the inner type of {fieldType}.
816814
- Let {completedResult} be the result of calling {CompleteValue(innerType,
817-
fields, result, variableValues)}.
815+
fieldSet, result, variableValues)}.
818816
- If {completedResult} is {null}, raise an _execution error_.
819817
- Return {completedResult}.
820818
- If {result} is {null} (or another internal value similar to {null} such as
@@ -823,7 +821,7 @@ CompleteValue(fieldType, fields, result, variableValues):
823821
- If {result} is not a collection of values, raise an _execution error_.
824822
- Let {innerType} be the inner type of {fieldType}.
825823
- Return a list where each list item is the result of calling
826-
{CompleteValue(innerType, fields, resultItem, variableValues)}, where
824+
{CompleteValue(innerType, fieldSet, resultItem, variableValues)}, where
827825
{resultItem} is each item in {result}.
828826
- If {fieldType} is a Scalar or Enum type:
829827
- Return the result of {CoerceResult(fieldType, result)}.
@@ -833,7 +831,7 @@ CompleteValue(fieldType, fields, result, variableValues):
833831
- Otherwise if {fieldType} is an Interface or Union type.
834832
- Let {objectType} be {ResolveAbstractType(fieldType, result)}.
835833
- Let {groupedFieldSet} be the result of calling {CollectSubfields(objectType,
836-
fields, variableValues)}.
834+
fieldSet, variableValues)}.
837835
- Return the result of evaluating {ExecuteCollectedFields(groupedFieldSet,
838836
objectType, result, variableValues)} _normally_ (allowing for
839837
parallelization).

0 commit comments

Comments
 (0)