Skip to content

Commit 9939469

Browse files
authored
Minor editorial tweaks following the merge of #1039 (#1175)
* Resolve ambiguity - we mean return type For `type User { name: String }`, `User.name` is a field of an object type (`User`). Clarify that we mean the return type of the field, not the type to which it belongs. * Consistency with collectedFieldsMap * Reword to avoid 'During execution, ... before execution.' * Serial execution relates to the set of fields, not each individual field * Add missing close parenthesis * Remove duplicate 'by', specific algorithm is detailed in next paragraph * CollectFields() produces many _field set_ * Minor edits
1 parent 468d848 commit 9939469

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

spec/Section 3 -- Type System.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,8 @@ type Person {
775775
}
776776
```
777777

778-
Valid operations must supply a _selection set_ for every field of an object
779-
type, so this operation is not valid:
778+
Valid operations must supply a _selection set_ for every field whose return type
779+
is an object type, so this operation is not valid:
780780

781781
```graphql counter-example
782782
{

spec/Section 5 -- Validation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,11 @@ CollectSubscriptionFields(objectType, selectionSet, visitedFragments):
334334
- If {DoesFragmentTypeApply(objectType, fragmentType)} is {false}, continue
335335
with the next {selection} in {selectionSet}.
336336
- Let {fragmentSelectionSet} be the top-level selection set of {fragment}.
337-
- Let {fragmentCollectedFieldMap} be the result of calling
337+
- Let {fragmentCollectedFieldsMap} be the result of calling
338338
{CollectSubscriptionFields(objectType, fragmentSelectionSet,
339339
visitedFragments)}.
340340
- For each {responseName} and {fragmentFields} in
341-
{fragmentCollectedFieldMap}:
341+
{fragmentCollectedFieldsMap}:
342342
- Let {fieldsForResponseKey} be the _field set_ value in
343343
{collectedFieldsMap} for the key {responseName}; otherwise create the
344344
entry with an empty ordered set.
@@ -349,11 +349,11 @@ CollectSubscriptionFields(objectType, selectionSet, visitedFragments):
349349
fragmentType)} is {false}, continue with the next {selection} in
350350
{selectionSet}.
351351
- Let {fragmentSelectionSet} be the top-level selection set of {selection}.
352-
- Let {fragmentCollectedFieldMap} be the result of calling
352+
- Let {fragmentCollectedFieldsMap} be the result of calling
353353
{CollectSubscriptionFields(objectType, fragmentSelectionSet,
354354
visitedFragments)}.
355355
- For each {responseName} and {fragmentFields} in
356-
{fragmentCollectedFieldMap}:
356+
{fragmentCollectedFieldsMap}:
357357
- Let {fieldsForResponseKey} be the _field set_ value in
358358
{collectedFieldsMap} for the key {responseName}; otherwise create the
359359
entry with an empty ordered set.
@@ -584,7 +584,7 @@ should be unambiguous. Therefore any two field selections which might both be
584584
encountered for the same object are only valid if they are equivalent.
585585

586586
During execution, the simultaneous execution of fields with the same response
587-
name is accomplished by {CollectSubfields()} before execution.
587+
name is accomplished by performing {CollectSubfields()} before their execution.
588588

589589
For simple hand-written GraphQL, this rule is obviously a clear developer error,
590590
however nested fragments can make this difficult to detect manually.

spec/Section 6 -- Execution.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ continues until there are no more subfields to collect and execute.
369369
operation. A root selection set always selects from a _root operation type_.
370370

371371
To execute the root selection set, the initial value being evaluated and the
372-
root type must be known, as well as whether each field must be executed
373-
serially, or normally by executing all fields in parallel (see
374-
[Normal and Serial Execution](#sec-Normal-and-Serial-Execution).
372+
root type must be known, as well as whether the fields must be executed in a
373+
series, or normally by executing all fields in parallel (see
374+
[Normal and Serial Execution](#sec-Normal-and-Serial-Execution)).
375375

376376
Executing the root selection set works similarly for queries (parallel),
377377
mutations (serial), and subscriptions (where it is executed for each event in
@@ -396,10 +396,9 @@ executionMode):
396396
### Field Collection
397397

398398
Before execution, each _selection set_ is converted to a _collected fields map_
399-
by calling {CollectFields()} by collecting all fields with the same response
400-
name, including those in referenced fragments, into an individual _field set_.
401-
This ensures that multiple references to fields with the same response name will
402-
only be executed once.
399+
by collecting all fields with the same response name, including those in
400+
referenced fragments, into an individual _field set_. This ensures that multiple
401+
references to fields with the same response name will only be executed once.
403402

404403
:: A _collected fields map_ is an ordered map where each entry is a _response
405404
name_ and its associated _field set_. A _collected fields map_ may be produced
@@ -436,8 +435,8 @@ fragment ExampleFragment on Query {
436435
}
437436
```
438437

439-
The depth-first-search order of the _field set_ produced by {CollectFields()} is
440-
maintained through execution, ensuring that fields appear in the executed
438+
The depth-first-search order of each _field set_ produced by {CollectFields()}
439+
is maintained through execution, ensuring that fields appear in the executed
441440
response in a stable and predictable order.
442441

443442
CollectFields(objectType, selectionSet, variableValues, visitedFragments):
@@ -475,11 +474,11 @@ CollectFields(objectType, selectionSet, variableValues, visitedFragments):
475474
- If {DoesFragmentTypeApply(objectType, fragmentType)} is {false}, continue
476475
with the next {selection} in {selectionSet}.
477476
- Let {fragmentSelectionSet} be the top-level selection set of {fragment}.
478-
- Let {fragmentCollectedFieldMap} be the result of calling
477+
- Let {fragmentCollectedFieldsMap} be the result of calling
479478
{CollectFields(objectType, fragmentSelectionSet, variableValues,
480479
visitedFragments)}.
481480
- For each {responseName} and {fragmentFields} in
482-
{fragmentCollectedFieldMap}:
481+
{fragmentCollectedFieldsMap}:
483482
- Let {fieldsForResponseName} be the _field set_ value in
484483
{collectedFieldsMap} for the key {responseName}; otherwise create the
485484
entry with an empty ordered set.
@@ -490,11 +489,11 @@ CollectFields(objectType, selectionSet, variableValues, visitedFragments):
490489
fragmentType)} is {false}, continue with the next {selection} in
491490
{selectionSet}.
492491
- Let {fragmentSelectionSet} be the top-level selection set of {selection}.
493-
- Let {fragmentCollectedFieldMap} be the result of calling
492+
- Let {fragmentCollectedFieldsMap} be the result of calling
494493
{CollectFields(objectType, fragmentSelectionSet, variableValues,
495494
visitedFragments)}.
496495
- For each {responseName} and {fragmentFields} in
497-
{fragmentCollectedFieldMap}:
496+
{fragmentCollectedFieldsMap}:
498497
- Let {fieldsForResponseName} be the _field set_ value in
499498
{collectedFieldsMap} for the key {responseName}; otherwise create the
500499
entry with an empty ordered set.
@@ -518,8 +517,8 @@ directives may be applied in either order since they apply commutatively.
518517

519518
**Merging Selection Sets**
520519

521-
In order to execute the sub-selections of a object typed field, all _selection
522-
sets_ of each field with the same response name of the parent _field set_ are
520+
In order to execute the sub-selections of an object typed field, all _selection
521+
sets_ of each field with the same response name in the parent _field set_ are
523522
merged together into a single _collected fields map_ representing the subfields
524523
to be executed next.
525524

@@ -554,9 +553,9 @@ CollectSubfields(objectType, fields, variableValues):
554553
- For each {field} in {fields}:
555554
- Let {fieldSelectionSet} be the selection set of {field}.
556555
- If {fieldSelectionSet} is null or empty, continue to the next field.
557-
- Let {fieldCollectedFieldMap} be the result of {CollectFields(objectType,
556+
- Let {fieldCollectedFieldsMap} be the result of {CollectFields(objectType,
558557
fieldSelectionSet, variableValues)}.
559-
- For each {responseName} and {subfields} in {fieldCollectedFieldMap}:
558+
- For each {responseName} and {subfields} in {fieldCollectedFieldsMap}:
560559
- Let {fieldsForResponseName} be the _field set_ value in
561560
{collectedFieldsMap} for the key {responseName}; otherwise create the
562561
entry with an empty ordered set.

0 commit comments

Comments
 (0)