-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I wanted to open an issue for discussion of incremental delivery with the @defer
and @stream
directives in Argo.
Following the specs in graphql/graphql-spec#742, which is now in the "Draft (RFC 2)" state, the following is a potential wire-type solution for dealing with these incremental responses:
schema {
query: Query
}
type Query {
root: Object!
}
type Object {
children: [Object!]!
}
query {
root {
required: __typename
... @defer {
deferred_x: __typename
}
... @defer(label: "defer_z") {
deferred_y: __typename
}
children_x: children @stream {
streamed_x: __typename
}
children_y: children @stream(label: "stream_z") {
streamed_y: __typename
}
}
}
The examples below use an ERROR
wire type that is an alias to the following:
{
message: STRING<String>
location?: {
line: VARINT<Int>
column: VARINT<Int>
}[]
path?: PATH
extensions?: DESC_OBJECT
}
In addition, a new wire type referred to as UNION
(a tagged union type similar to the one found in BARE).
{
data?: {
root: {
required: STRING<String>
deferred_x?: STRING<String>
deferred_y?: STRING<String>
children_x: {
streamed_x: STRING<String>
}[]
children_y: {
streamed_y: STRING<String>
}[]
}
}?
incremental?: UNION {
<0>: {
path: PATH
data: {
deferred_x: STRING<String>
}?
errors?: ERROR[]?
extensions?: DESC_OBJECT
}
<1:"defer_z">: {
path: PATH
data: {
deferred_y: STRING<String>
}?
errors?: ERROR[]?
extensions?: DESC_OBJECT
}
<2>: {
path: PATH
items: {
streamed_x: STRING<String>
}[]
errors?: ERROR[]?
extensions?: DESC_OBJECT
}
<3:"stream_z">: {
path: PATH
items: {
streamed_y: STRING<String>
}[]
errors?: ERROR[]?
extensions?: DESC_OBJECT
}
}[]
hasNext?: BOOLEAN<Boolean>
errors?: ERROR[]?
extensions?: DESC_OBJECT
}
Any initial thoughts or opinions? Thanks!
Metadata
Metadata
Assignees
Labels
No labels