-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spec edits for incremental delivery, Response Section and Examples Appendix #1203
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
base: incremental-integration
Are you sure you want to change the base?
Changes from 11 commits
644df1d
c54049c
ff9c30c
554bf1b
00c726b
048315e
0a424c1
1904ef4
03242f0
68a01de
b9d8e8a
ffacdf4
e928e0f
711f708
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,210 @@ | ||||||
| # E. Appendix: Examples | ||||||
|
|
||||||
| ## Incremental Delivery Examples | ||||||
|
|
||||||
| ### Example 1 - A query containing both defer and stream | ||||||
|
|
||||||
| ```graphql example | ||||||
| query { | ||||||
| person(id: "cGVvcGxlOjE=") { | ||||||
| ...HomeWorldFragment @defer(label: "homeWorldDefer") | ||||||
| name | ||||||
| films @stream(initialCount: 1, label: "filmsStream") { | ||||||
| title | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| fragment HomeWorldFragment on Person { | ||||||
| homeWorld { | ||||||
| name | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| The response to this request will be an _incremental stream_ consisting of an | ||||||
| _initial incremental stream result_ followed by one or more _incremental stream | ||||||
| update result_. | ||||||
|
|
||||||
| The _initial incremental stream result_ has: | ||||||
|
|
||||||
| - a {"data"} entry containing the results of the GraphQL operation except for | ||||||
| the `@defer` and `@stream` selections; | ||||||
| - a {"pending"} entry containing two _pending result_, one for the `@defer` | ||||||
| selection and for the the `@stream` selection, indicating that these results | ||||||
| will be delivered in a later _incremental stream update result_; | ||||||
| - a {"hasNext"} entry with the value {true}, indicating that the response is not | ||||||
| yet complete. | ||||||
|
|
||||||
| If an error were to occur, it would also have an {"error"} entry; but not in | ||||||
| this example. | ||||||
|
|
||||||
| ```json example | ||||||
| { | ||||||
| "data": { | ||||||
| "person": { | ||||||
| "name": "Luke Skywalker", | ||||||
| "films": [{ "title": "A New Hope" }] | ||||||
| } | ||||||
| }, | ||||||
| "pending": [ | ||||||
| { "id": "0", "path": ["person"], "label": "homeWorldDefer" }, | ||||||
| { "id": "1", "path": ["person", "films"], "label": "filmsStream" } | ||||||
| ], | ||||||
| "hasNext": true | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| Depending on the behavior of the backend and the time at which the deferred and | ||||||
| streamed resources resolve, the stream may produce results in different orders. | ||||||
| In this example, our first _incremental stream update result_ contains the | ||||||
| deferred data and the first streamed list item. There is one _completed result_, | ||||||
|
||||||
| deferred data and the first streamed list item. There is one _completed result_, | |
| deferred data and the first streamed list item. There is one _incremental completion result_, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated now to incremental completion notice
robrichard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
robrichard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
robrichard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the weirdness of this needs more calling out - name belongs to both id:0 and id:1, so we're kind of using id:0 as a shortcut (but id:1 would also work). We should make it clear to a client that it can't form HomeWorldFragment from solely the root data plus the id:0 stuff and NameAndHomeWorldFragment from solely the root data and the id:1 stuff - they must merge the trees before extracting the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh oh!
There was an error while loading. Please reload this page.