Skip to content

Commit b41339a

Browse files
authored
Editorial: Add response stream to Response Section (#1135)
* Add response stream to Response Section * avoid future tense
1 parent 04fbcae commit b41339a

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

spec/Section 6 -- Execution.md

Lines changed: 8 additions & 8 deletions
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

Lines changed: 11 additions & 1 deletion
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

0 commit comments

Comments
 (0)