-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting Incremental Delivery with @defer/@stream directives #12
Comments
I think this makes a lot of sense. In Argo, we'd probably want to note that it's subject to change to whatever is eventually incorporated into the GrapQL spec. Here are a variety of notes and thoughts:
Thanks for looking into this! |
Yeah, I played around with a few different options here as well, but I thought a simple VARINT tagged UNION might be the simplest solution. The label representation
Oh, yup, you're correct. I wrote the pseudo wire type by hand so there may be other accidental mistakes.
The schema {
query: Query
}
type Query {
x: X!
}
type X {
ys: [Y!]!
}
type Y {
z: Z!
}
type Z {
name: String!
} query {
x {
ys {
z {
__typename
... @defer {
name
}
}
}
}
} The
Correct, it's primarily used for converting from and to the JSON representation, only the VARINT index is encoded/decoded for the tagged UNION.
There's some discussion in the PR about this:
I don't think At least that's my current understanding after reading through the specs. For
Following the wording the Errors section of the GraphQL Spec:
Nothing is explicitly stated about This also seems to imply that the typing for What do you think?
Yeah, I thought about potentially introducing a {
"type": "RESPONSE",
"data": {
"type": "RECORD",
"fields": [...]
},
"incremental": [
{
"type": "DEFER",
"index": 0,
"data": ...
},
{
"type": "STREAM",
"index": 1,
"item": ...
}
]
} Internally, it could expand to the full wire-type involving Fields underneath the This would also make it so the encoding for |
Yeah, it would be handy to have the label value available. Instead of baking it into the union (which is probably the only place it will be used), I'm somewhat more inclined to introduce a type like CONST_STRING:
Another small bummer, but clear enough. It would naturally extend to constants of other types, or even default values, but GraphQL has little or no need for these at the moment.
Great explanation, thanks. The same probably applies to
Your reasoning makes sense to me, I had just checked what types I used in the reference implementation for ERROR. IIRC I wanted to support whatever JSON folks might have, but I like the stricter approach you take.
Nice. I think for now it's probably simplest to leave it up to implementations, and have the spec use the maximally-expanded version which everything must eventually be equivalent to. |
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:
The examples below use an
ERROR
wire type that is an alias to the following:In addition, a new wire type referred to as
UNION
(a tagged union type similar to the one found in BARE).Any initial thoughts or opinions? Thanks!
The text was updated successfully, but these errors were encountered: