Glossary #106
Replies: 2 comments 4 replies
-
This currently doesn't take into consideration subscriptions:
Perhaps:
(I've not pluralized "incremental results", because this allows the glossary feature to be used if we move this into the spec.) To help think about this, here's a rough shape of the things I see in TS syntax: /** A regular GraphQL response for a traditional GraphQL query/mutation */
interface Response {
data?: object
errors?: Error[]
}
/** A stream of responses returned from a GraphQL subscription - each event triggers a new response */
type ResponseStream = Response[];
/** A GraphQL operation that uses @stream/@defer may return an "incremental stream": an initial response followed by one more more incremental results */
type IncrementalStream = [InitialResponse, ...IncrementalResult[]];
interface InitialResponse extends Response {
pending: ...
hasNext: true;
}
type IncrementalResult =
| {
incremental: IncrementalSomething[]
pending?: ...
completed?: ...
hasNext?: boolean
}
| { hasNext: false }
interface IncrementalSomething {
...
} Not sure what to call |
Beta Was this translation helpful? Give feedback.
-
What about adding those to the general Glossary? |
Beta Was this translation helpful? Give feedback.
-
This discussion will be used to document terms related to incremental delivery being used in the GraphQL Spec text:
Response Format
The result of a GraphQL request can either a single initial response or an incremental stream. An incremental stream is made up of an initial response, followed by one or more subsequent responses.
Initial response:
@defer
and@stream
.data
,errors
,extensions
.@defer
and@stream
, it may also be the first response from an incremental stream. If so, it must containhasNext: true
and may containpending
,incremental
,completed
.Subsequent response:
data
orerrors
hasNext
pending
,incremental
,completed
.Pending Result
pending
array in an initial or subsequent responseIncremental Result
incremental
array in an initial or subsequent responseCompleted Result
completed
array in an initial or subsequent responseBeta Was this translation helpful? Give feedback.
All reactions