Skip to content

Commit 640431c

Browse files
authored
Merge branch 'main' into fragment-args-2024-amendments
2 parents 3230384 + b5ecff0 commit 640431c

File tree

5 files changed

+56
-50
lines changed

5 files changed

+56
-50
lines changed

spec/Section 2 -- Language.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ There are three types of operations that GraphQL models:
291291
- subscription - a long-lived request that fetches data in response to source
292292
events.
293293

294-
Each operation is represented by an optional operation name and a selection set.
294+
Each operation is represented by an optional operation name and a _selection
295+
set_.
295296

296297
For example, this mutation operation might "like" a story and then retrieve the
297298
new number of likes:
@@ -337,6 +338,9 @@ An operation selects the set of information it needs, and will receive exactly
337338
that information and nothing more, avoiding over-fetching and under-fetching
338339
data.
339340

341+
:: A _selection set_ defines an ordered set of selections (fields, fragment
342+
spreads and inline fragments) against an object, union or interface type.
343+
340344
```graphql example
341345
{
342346
id
@@ -346,14 +350,14 @@ data.
346350
```
347351

348352
In this query operation, the `id`, `firstName`, and `lastName` fields form a
349-
selection set. Selection sets may also contain fragment references.
353+
_selection set_. Selection sets may also contain fragment references.
350354

351355
## Fields
352356

353357
Field : Alias? Name Arguments? Directives? SelectionSet?
354358

355-
A selection set is primarily composed of fields. A field describes one discrete
356-
piece of information available to request within a selection set.
359+
A _selection set_ is primarily composed of fields. A field describes one
360+
discrete piece of information available to request within a selection set.
357361

358362
Some fields describe complex data or relationships to other data. In order to
359363
further explore this data, a field may itself contain a selection set, allowing
@@ -381,7 +385,7 @@ down to scalar values.
381385
}
382386
```
383387

384-
Fields in the top-level selection set of an operation often represent some
388+
Fields in the top-level _selection set_ of an operation often represent some
385389
information that is globally accessible to your application and its current
386390
viewer. Some typical examples of these top fields include references to a
387391
current logged-in viewer, or accessing certain types of data referenced by a
@@ -667,9 +671,9 @@ be present and `likers` will not. Conversely when the result is a `Page`,
667671

668672
InlineFragment : ... TypeCondition? Directives? SelectionSet
669673

670-
Fragments can also be defined inline within a selection set. This is useful for
671-
conditionally including fields based on a type condition or applying a directive
672-
to a selection set.
674+
Fragments can also be defined inline within a _selection set_. This is useful
675+
for conditionally including fields based on a type condition or applying a
676+
directive to a selection set.
673677

674678
This feature of standard fragment inclusion was demonstrated in the
675679
`query FragmentTyping` example above. We could accomplish the same thing using
@@ -1307,7 +1311,7 @@ input type.
13071311
Type : Name
13081312

13091313
- Let {name} be the string value of {Name}.
1310-
- Let {type} be the type defined in the Schema named {name}
1314+
- Let {type} be the type defined in the Schema named {name}.
13111315
- {type} must not be {null}.
13121316
- Return {type}.
13131317

spec/Section 3 -- Type System.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ other input values must raise a _request error_ indicating an incorrect type.
613613
The ID scalar type represents a unique identifier, often used to refetch an
614614
object or as the key for a cache. The ID type is serialized in the same way as a
615615
{String}; however, it is not intended to be human-readable. While it is often
616-
numeric, it should always serialize as a {String}.
616+
numeric, it must always serialize as a {String}.
617617

618618
**Result Coercion**
619619

@@ -677,8 +677,8 @@ operations, Objects describe the intermediate levels.
677677
GraphQL Objects represent a list of named fields, each of which yield a value of
678678
a specific type. Object values should be serialized as ordered maps, where the
679679
selected field names (or aliases) are the keys and the result of evaluating the
680-
field is the value, ordered by the order in which they appear in the selection
681-
set.
680+
field is the value, ordered by the order in which they appear in the _selection
681+
set_.
682682

683683
All fields defined within an Object type must not have a name which begins with
684684
{"\_\_"} (two underscores), as this is used exclusively by GraphQL's
@@ -1026,7 +1026,7 @@ Object, Interface, or Union type).
10261026
### Field Deprecation
10271027

10281028
Fields in an object may be marked as deprecated as deemed necessary by the
1029-
application. It is still legal to include these fields in a selection set (to
1029+
application. It is still legal to include these fields in a _selection set_ (to
10301030
ensure existing clients are not broken by the change), but the fields should be
10311031
appropriately treated in documentation and tooling.
10321032

@@ -1142,7 +1142,7 @@ type Contact {
11421142
}
11431143
```
11441144

1145-
This allows us to write a selection set for a `Contact` that can select the
1145+
This allows us to write a _selection set_ for a `Contact` that can select the
11461146
common fields.
11471147

11481148
```graphql example
@@ -1795,9 +1795,9 @@ to denote a field that uses a Non-Null type like this: `name: String!`.
17951795

17961796
**Nullable vs. Optional**
17971797

1798-
Fields are _always_ optional within the context of a selection set, a field may
1799-
be omitted and the selection set is still valid (so long as the selection set
1800-
does not become empty). However fields that return Non-Null types will never
1798+
Fields are _always_ optional within the context of a _selection set_, a field
1799+
may be omitted and the selection set is still valid (so long as the selection
1800+
set does not become empty). However fields that return Non-Null types will never
18011801
return the value {null} if queried.
18021802

18031803
Inputs (such as field arguments), are always optional by default. However a

spec/Section 4 -- Introspection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ underscores {"\_\_"}.
6868

6969
## Type Name Introspection
7070

71-
GraphQL supports type name introspection within any selection set in an
71+
GraphQL supports type name introspection within any _selection set_ in an
7272
operation, with the single exception of selections at the root of a subscription
7373
operation. Type name introspection is accomplished via the meta-field
7474
`__typename: String!` on any Object, Interface, or Union. It returns the name of

spec/Section 6 -- Execution.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,16 @@ respectively.
121121
### Query
122122

123123
If the operation is a query, the result of the operation is the result of
124-
executing the operation’s top level selection set with the query root operation
125-
type.
124+
executing the operation’s top level _selection set_ with the query root
125+
operation type.
126126

127127
An initial value may be provided when executing a query operation.
128128

129129
ExecuteQuery(query, schema, variableValues, initialValue):
130130

131131
- Let {queryType} be the root Query type in {schema}.
132132
- Assert: {queryType} is an Object type.
133-
- Let {selectionSet} be the top level Selection Set in {query}.
133+
- Let {selectionSet} be the top level selection set in {query}.
134134
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
135135
queryType, initialValue, variableValues)} _normally_ (allowing
136136
parallelization).
@@ -141,7 +141,7 @@ ExecuteQuery(query, schema, variableValues, initialValue):
141141
### Mutation
142142

143143
If the operation is a mutation, the result of the operation is the result of
144-
executing the operation’s top level selection set on the mutation root object
144+
executing the operation’s top level _selection set_ on the mutation root object
145145
type. This selection set should be executed serially.
146146

147147
It is expected that the top level fields in a mutation operation perform
@@ -152,7 +152,7 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
152152

153153
- Let {mutationType} be the root Mutation type in {schema}.
154154
- Assert: {mutationType} is an Object type.
155-
- Let {selectionSet} be the top level Selection Set in {mutation}.
155+
- Let {selectionSet} be the top level selection set in {mutation}.
156156
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
157157
mutationType, initialValue, variableValues)} _serially_.
158158
- Let {errors} be the list of all _field error_ raised while executing the
@@ -255,7 +255,7 @@ CreateSourceEventStream(subscription, schema, variableValues, initialValue):
255255

256256
- Let {subscriptionType} be the root Subscription type in {schema}.
257257
- Assert: {subscriptionType} is an Object type.
258-
- Let {selectionSet} be the top level Selection Set in {subscription}.
258+
- Let {selectionSet} be the top level selection set in {subscription}.
259259
- Let {groupedFieldSet} be the result of {CollectFields(subscriptionType,
260260
selectionSet, variableValues)}.
261261
- If {groupedFieldSet} does not have exactly one entry, raise a _request error_.
@@ -285,7 +285,7 @@ operation type.
285285
#### Response Stream
286286

287287
Each event in the underlying Source Stream triggers execution of the
288-
subscription selection set using that event as a root value.
288+
subscription _selection set_ using that event as a root value.
289289

290290
MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
291291

@@ -300,7 +300,7 @@ ExecuteSubscriptionEvent(subscription, schema, variableValues, initialValue):
300300

301301
- Let {subscriptionType} be the root Subscription type in {schema}.
302302
- Assert: {subscriptionType} is an Object type.
303-
- Let {selectionSet} be the top level Selection Set in {subscription}.
303+
- Let {selectionSet} be the top level selection set in {subscription}.
304304
- Let {data} be the result of running {ExecuteSelectionSet(selectionSet,
305305
subscriptionType, initialValue, variableValues)} _normally_ (allowing
306306
parallelization).
@@ -324,9 +324,9 @@ Unsubscribe(responseStream):
324324

325325
## Executing Selection Sets
326326

327-
To execute a selection set, the object value being evaluated and the object type
328-
need to be known, as well as whether it must be executed serially, or may be
329-
executed in parallel.
327+
To execute a _selection set_, the object value being evaluated and the object
328+
type need to be known, as well as whether it must be executed serially, or may
329+
be executed in parallel.
330330

331331
First, the selection set is turned into a grouped field set; then, each
332332
represented field in the grouped field set produces an entry into a response
@@ -398,10 +398,11 @@ entry from the grouped field set in the order provided in the grouped field set.
398398
It must determine the corresponding entry in the result map for each item to
399399
completion before it continues on to the next item in the grouped field set:
400400

401-
For example, given the following selection set to be executed serially:
401+
For example, given the following mutation operation, the root _selection set_
402+
must be executed serially:
402403

403404
```graphql example
404-
{
405+
mutation ChangeBirthdayAndAddress($newBirthday: String!, $newAddress: String!) {
405406
changeBirthday(birthday: $newBirthday) {
406407
month
407408
}
@@ -411,7 +412,7 @@ For example, given the following selection set to be executed serially:
411412
}
412413
```
413414

414-
The executor must, in serial:
415+
Therefore the executor must, in serial:
415416

416417
- Run {ExecuteField()} for `changeBirthday`, which during {CompleteValue()} will
417418
execute the `{ month }` sub-selection set normally.
@@ -420,9 +421,10 @@ The executor must, in serial:
420421

421422
As an illustrative example, let's assume we have a mutation field
422423
`changeTheNumber` that returns an object containing one field, `theNumber`. If
423-
we execute the following selection set serially:
424+
we execute the following _selection set_ serially:
424425

425426
```graphql example
427+
# Note: This is a selection set, not a full document using the query shorthand.
426428
{
427429
first: changeTheNumber(newNumber: 1) {
428430
theNumber
@@ -445,7 +447,7 @@ The executor will execute the following serially:
445447
- Resolve the `changeTheNumber(newNumber: 2)` field
446448
- Execute the `{ theNumber }` sub-selection set of `third` normally
447449

448-
A correct executor must generate the following result for that selection set:
450+
A correct executor must generate the following result for that _selection set_:
449451

450452
```json example
451453
{
@@ -463,7 +465,7 @@ A correct executor must generate the following result for that selection set:
463465

464466
### Field Collection
465467

466-
Before execution, the selection set is converted to a grouped field set by
468+
Before execution, the _selection set_ is converted to a grouped field set by
467469
calling {CollectFields()}. Each entry in the grouped field set is a list of
468470
fields that share a response key (the alias if defined, otherwise the field
469471
name). This ensures all fields with the same response key (including those in
@@ -779,9 +781,9 @@ ResolveAbstractType(abstractType, objectValue):
779781

780782
**Merging Selection Sets**
781783

782-
When more than one field of the same name is executed in parallel, their
783-
selection sets are merged together when completing the value in order to
784-
continue execution of the sub-selection sets.
784+
When more than one field of the same name is executed in parallel, the
785+
_selection set_ for each of the fields are merged together when completing the
786+
value in order to continue execution of the sub-selection sets.
785787

786788
An example operation illustrating parallel fields with the same name with
787789
sub-selections.

spec/Section 7 -- Response.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ must contain an entry with the key `path` that details the path of the response
109109
field which experienced the error. This allows clients to identify whether a
110110
`null` result is intentional or caused by a runtime error.
111111

112-
This field should be a list of path segments starting at the root of the
113-
response and ending with the field associated with the error. Path segments that
114-
represent fields should be strings, and path segments that represent list
115-
indices should be 0-indexed integers. If the error happens in an aliased field,
116-
the path to the error should use the aliased name, since it represents a path in
112+
If present, this field must be a list of path segments starting at the root of
113+
the response and ending with the field associated with the error. Path segments
114+
that represent fields must be strings, and path segments that represent list
115+
indices must be 0-indexed integers. If the error happens in an aliased field,
116+
the path to the error must use the aliased name, since it represents a path in
117117
the response, not in the request.
118118

119119
For example, if fetching one of the friends' names fails in the following
@@ -294,13 +294,13 @@ JSON format throughout this document.
294294

295295
### Serialized Map Ordering
296296

297-
Since the result of evaluating a selection set is ordered, the serialized Map of
298-
results should preserve this order by writing the map entries in the same order
299-
as those fields were requested as defined by selection set execution. Producing
300-
a serialized response where fields are represented in the same order in which
301-
they appear in the request improves human readability during debugging and
302-
enables more efficient parsing of responses if the order of properties can be
303-
anticipated.
297+
Since the result of evaluating a _selection set_ is ordered, the serialized Map
298+
of results should preserve this order by writing the map entries in the same
299+
order as those fields were requested as defined by selection set execution.
300+
Producing a serialized response where fields are represented in the same order
301+
in which they appear in the request improves human readability during debugging
302+
and enables more efficient parsing of responses if the order of properties can
303+
be anticipated.
304304

305305
Serialization formats which represent an ordered map should preserve the order
306306
of requested fields as defined by {CollectFields()} in the Execution section.

0 commit comments

Comments
 (0)