Skip to content

Commit 0c25faa

Browse files
committed
Merge branch 'main' into values-of-correct-type-variables
2 parents 7d9baa9 + b41339a commit 0c25faa

5 files changed

+64
-21
lines changed

CONTRIBUTING.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ contributions.
66

77
Contributions that do not change the interpretation of the spec but instead
88
improve legibility, fix editorial errors, clear up ambiguity and improve
9-
examples are encouraged and are often merged by a spec editor with little
10-
process.
9+
examples are encouraged. These "editorial changes" will normally be given the
10+
["✏ Editorial" label](https://github.com/graphql/graphql-spec/issues?q=sort%3Aupdated-desc+is%3Aopen+label%3A%22%E2%9C%8F%EF%B8%8F+Editorial%22)
11+
and are often merged by a spec editor with little process.
1112

1213
However, contributions that _do_ meaningfully change the interpretation of the
1314
spec must follow an RFC (Request For Comments) process led by a _champion_

STYLE_GUIDE.md

+22
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,25 @@ MyAlgorithm(argOne, argTwo):
8282
- Let {something} be {true}.
8383
- Return {something}.
8484
```
85+
86+
## Definitions
87+
88+
For important terms, use
89+
[Spec Markdown definition paragraphs](https://spec-md.com/#sec-Definition-Paragraph).
90+
91+
Definition paragraphs start with `::` and add the matching italicized term to
92+
the [specification index](https://spec.graphql.org/draft/#index), making it easy
93+
to reference them.
94+
95+
## Tone of voice
96+
97+
The GraphQL specification is a reference document and should use neutral and
98+
descriptive tone of voice.
99+
100+
**Favor the present tense**
101+
102+
The present tense is usually clearer and shorter:
103+
104+
✅ Present: The client then sends a request to the server.
105+
106+
❌ Future: The client will then send a request to the server.

spec/Section 5 -- Validation.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ FieldsInSetCanMerge(set):
420420

421421
- Let {fieldsForName} be the set of selections with a given response name in
422422
{set} including visiting fragments and inline fragments.
423-
- Given each pair of members {fieldA} and {fieldB} in {fieldsForName}:
423+
- Given each pair of distinct members {fieldA} and {fieldB} in {fieldsForName}:
424424
- {SameResponseShape(fieldA, fieldB)} must be true.
425425
- If the parent types of {fieldA} and {fieldB} are equal or if either is not
426426
an Object Type:
@@ -452,7 +452,8 @@ SameResponseShape(fieldA, fieldB):
452452
selection set of {fieldB}.
453453
- Let {fieldsForName} be the set of selections with a given response name in
454454
{mergedSet} including visiting fragments and inline fragments.
455-
- Given each pair of members {subfieldA} and {subfieldB} in {fieldsForName}:
455+
- Given each pair of distinct members {subfieldA} and {subfieldB} in
456+
{fieldsForName}:
456457
- If {SameResponseShape(subfieldA, subfieldB)} is {false}, return {false}.
457458
- Return {true}.
458459

spec/Section 6 -- Execution.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ ExecuteMutation(mutation, schema, variableValues, initialValue):
165165
### Subscription
166166

167167
If the operation is a subscription, the result is an _event stream_ called the
168-
"Response Stream" where each event in the event stream is the result of
169-
executing the operation for each new event on an underlying "Source Stream".
168+
_response stream_ where each event in the event stream is the result of
169+
executing the operation for each new event on an underlying _source stream_.
170170

171171
Executing a subscription operation creates a persistent function on the service
172-
that maps an underlying Source Stream to a returned Response Stream.
172+
that maps an underlying _source stream_ to a returned _response stream_.
173173

174174
Subscribe(subscription, schema, variableValues, initialValue):
175175

@@ -257,9 +257,9 @@ service details should be chosen by the implementing service.
257257

258258
#### Source Stream
259259

260-
A Source Stream is an _event stream_ representing a sequence of root values,
261-
each of which will trigger a GraphQL execution. Like field value resolution, the
262-
logic to create a Source Stream is application-specific.
260+
:: A _source stream_ is an _event stream_ representing a sequence of root
261+
values, each of which will trigger a GraphQL execution. Like field value
262+
resolution, the logic to create a _source stream_ is application-specific.
263263

264264
CreateSourceEventStream(subscription, schema, variableValues, initialValue):
265265

@@ -294,7 +294,7 @@ operation type.
294294

295295
#### Response Stream
296296

297-
Each event from the underlying Source Stream triggers execution of the
297+
Each event from the underlying _source stream_ triggers execution of the
298298
subscription _selection set_ using that event's value as the {initialValue}.
299299

300300
MapSourceToResponseEvent(sourceStream, subscription, schema, variableValues):
@@ -339,7 +339,7 @@ Note: The {ExecuteSubscriptionEvent()} algorithm is intentionally similar to
339339

340340
#### Unsubscribe
341341

342-
Unsubscribe cancels the Response Stream when a client no longer wishes to
342+
Unsubscribe cancels the _response stream_ when a client no longer wishes to
343343
receive payloads for a subscription. This in turn also cancels the Source
344344
Stream, which is a good opportunity to clean up any other resources used by the
345345
subscription.

spec/Section 7 -- Response.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ the case that any _field error_ was raised on a field and was replaced with
1010

1111
## Response Format
1212

13-
A response to a GraphQL request must be a map.
13+
A GraphQL request returns either a _response_ or a _response stream_.
14+
15+
### Response
16+
17+
:: A GraphQL request returns a _response_ when the GraphQL operation is a query
18+
or mutation. A _response_ must be a map.
1419

1520
If the request raised any errors, the response map must contain an entry with
1621
key `errors`. The value of this entry is described in the "Errors" section. If
@@ -35,6 +40,11 @@ Note: When `errors` is present in the response, it may be helpful for it to
3540
appear first when serialized to make it more clear when errors are present in a
3641
response during debugging.
3742

43+
### Response Stream
44+
45+
:: A GraphQL request returns a _response stream_ when the GraphQL operation is a
46+
subscription. A _response stream_ must be a stream of _response_.
47+
3848
### Data
3949

4050
The `data` entry in the response will be the result of the execution of the
@@ -107,14 +117,8 @@ syntax element.
107117
If an error can be associated to a particular field in the GraphQL result, it
108118
must contain an entry with the key `path` that details the path of the response
109119
field which experienced the error. This allows clients to identify whether a
110-
`null` result is intentional or caused by a runtime error.
111-
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
117-
the response, not in the request.
120+
`null` result is intentional or caused by a runtime error. The value of this
121+
_path entry_ is described in the [Path](#sec-Path) section.
118122

119123
For example, if fetching one of the friends' names fails in the following
120124
operation:
@@ -244,6 +248,21 @@ discouraged.
244248
}
245249
```
246250

251+
### Path
252+
253+
:: A _path entry_ is an entry within an _error result_ that allows for
254+
association with a particular field reached during GraphQL execution.
255+
256+
The value for a _path entry_ must be a list of path segments starting at the
257+
root of the response and ending with the field to be associated with. Path
258+
segments that represent fields must be strings, and path segments that represent
259+
list indices must be 0-indexed integers. If a path segment is associated with an
260+
aliased field it must use the aliased name, since it represents a path in the
261+
response, not in the request.
262+
263+
When the _path entry_ is present on an _error result_, it identifies the
264+
response field which experienced the error.
265+
247266
## Serialization Format
248267

249268
GraphQL does not require a specific serialization format. However, clients

0 commit comments

Comments
 (0)