-
Notifications
You must be signed in to change notification settings - Fork 66
Adds Variable Batching Proposal #307
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: main
Are you sure you want to change the base?
Changes from 1 commit
ac935e4
ba03118
e7b37d9
f159e73
6c995bd
c8755c8
654165b
c9c4253
d1212a7
16be80a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,3 +137,23 @@ And the body: | |
] | ||
} | ||
``` | ||
|
||
### Response | ||
|
||
When a server receives a well-formed _variable batching request_, it MUST return a well‐formed stream of _GraphQL responses_. Each response in the stream corresponds to the result of validating and executing the requested operation with one set of variables. The server's response stream describes the outcome of each operation, including any errors encountered during the execution of the request. | ||
|
||
A server must comply with [RFC7231](https://datatracker.ietf.org/doc/html/rfc7231). | ||
|
||
Each response in the stream follows the standard GraphQL response format, with the addition of a required `variableIndex` field at the top level of each response. The `variableIndex` indicates the index of the variables map from the original request, allowing the client to associate each response with the correct set of variables. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The definition of the |
||
|
||
**Note:** The server MAY respond with results in any order. The `variableIndex` field ensures that clients can correctly match each response to its corresponding set of variables, regardless of the order in which the responses are returned. | ||
michaelstaib marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### Response Structure | ||
|
||
Each line in the JSON Lines (JSONL) response MUST include the following fields: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The combination of |
||
|
||
- **`variableIndex`** (Required, integer): The index of the corresponding variables map from the original request's `variables` array. This allows clients to match each response with the correct set of variables. | ||
- **`data`** (Optional, map): The data resulting from the execution of the GraphQL operation with the corresponding set of variables. | ||
- **`errors`** (Optional, array): An array of errors, if any were encountered during the execution of the operation. | ||
- **`extensions`** (Optional, map): A map that MAY include additional information about the request and execution, as needed by implementors. | ||
- |
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 don't think we should use the word "stream" here. I think "list" is fine; I think the default media type would likely be e.g.
application/graphql-response-list+json
(a JSON array of GraphQL responses) butapplication/jsonl
would allow for easier early parsing of responses when the client is stream-capable.