Skip to content

Commit 528509e

Browse files
committed
add note about final payloads
1 parent f922219 commit 528509e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

spec/Section 7 -- Response.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,29 @@ with key `data`. The value of this entry is described in the "Data" section. If
2323
the operation failed before execution, due to a syntax error, missing
2424
information, or validation error, this entry must not be present.
2525

26+
When the response of the GraphQL operation is an event stream, the first value
27+
will be the initial response. All subsequent values may contain `label` and
28+
`path` entries. These two entries are used by clients to identify the the
29+
`@defer` or `@stream` directive from the GraphQL operation that triggered this
30+
value to be returned by the event stream. The combination of these two entries
31+
must be unique across all values returned by the event stream.
32+
2633
If the response of the GraphQL operation is an event stream, each response map
2734
must contain an entry with key `hasNext`. The value of this entry is `true` for
2835
all but the last response in the stream. The value of this entry is `false` for
2936
the last response of the stream. This entry is not required for GraphQL
30-
operations that return a single response map.
37+
operations that return a single response map.
38+
39+
The GraphQL server may determine there are no more values in the event stream
40+
after a previous value with `hasNext`: `true` has been emitted. In this case
41+
the last value in the event stream should be a map without `data`, `label`,
42+
and `path` entries, and a `hasNext` entry with a value of `false`.
3143

3244
The response map may also contain an entry with key `extensions`. This entry,
3345
if set, must have a map as its value. This entry is reserved for implementors
3446
to extend the protocol however they see fit, and hence there are no additional
3547
restrictions on its contents.
3648

37-
When the response of the GraphQL operation is an event stream, the first value
38-
will be the initial response. All subsequent values must contain `label` and
39-
`path` entries. These two entries are used by clients to identify the the
40-
`@defer` or `@stream` directive from the GraphQL operation that triggered this
41-
value to be returned by the event stream. The combination of these two entries
42-
must be unique across all values returned by the event stream.
43-
4449
To ensure future changes to the protocol do not break existing servers and
4550
clients, the top level response map must not contain any entries other than the
4651
three described above.
@@ -250,7 +255,7 @@ When the `path` field is present on an "Error result", it indicates the response
250255
## Label
251256

252257
If the response of the GraphQL operation is an event stream, subsequent values
253-
will contain a string field `label`. This `label` is the same label passed to
258+
may contain a string field `label`. This `label` is the same label passed to
254259
the `@defer` or `@stream` directive that triggered this value. This allows
255260
clients to identify which `@defer` or `@stream` directive is associated with
256261
this value.

0 commit comments

Comments
 (0)