graphql / graphql/graphql-spec

Batch query operations

Open
#517 6 comments 7 reactions 0 assignees View on GitHub
👻 Needs Champion 💭 Strawman (RFC 0)
Dominant language
JavaScript
Stars
14.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

*This is a restricted version of #375.*

[I have this giant thing I was looking at doing with GH's GraphQL API](https://platform.github.community/t/differentiating-issues-from-prs/7322), but I ran into a stumbling block: I would need to issue a single request for each set of values rather than just reusing the query and plugging each variable in appropriately.

Instead, could we allow something like this: `{"query": "...", "variables": [...]}`, returning an array of `"data"` results rather than a single `"data"` object? Instead of `"variables"` being a single object, it's specified as an array of objects, where each entry is itself a standard variables object. This doesn't go as far as enabling variable dependencies like in #375, but it does allow a broad degree of batching that can be (and already is) optimized to death by database engines and other querying engines.

Server-side, this could be merged into a single tree with the parameters as array views at each position. This enables a broad array of potential optimizations without much cost.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.