graphql-stitching-ruby
graphql-stitching-ruby copied to clipboard
Extract batched stitching ids into request variables
At present, executor batching inlines all stitching IDs into their resolver queries:
query MyOperation_2 {
_0_result: widgets(ids:["a","b","c"]) { ... }
_1_0_result: sprocket(id:"x") { ... }
_1_1_result: sprocket(id:"y") { ... }
}
This is not ideal because it creates high request cardinality, which may defeat some backend caches. It would be generally better if requests stayed consistent when possible and submitted keys as request variables:
query MyOperation_2($_0_key: [ID!]!, $_1_0_key: ID!, $_1_1_key: ID!) {
_0_result: widgets(ids: $_0_key) { ... }
_1_0_result: sprocket(id: $_1_0_key) { ... }
_1_1_result: sprocket(id: $_1_1_key) { ... }
}
# variables: { "_0_key": ["a","b","c"], "_1_0_key": "x", "_1_1_key": "y" }