graphql-tools
graphql-tools copied to clipboard
GraphQL Stitching is losing "extensions" information from sub-schema response
Issue workflow progress
Progress of the issue based on the Contributor Workflow
- [ ] 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox
Make sure to fork this template and run
yarn generate
in the terminal.Please make sure the GraphQL Tools package versions under
package.json
matches yours. - [ ] 2. A failing test has been provided
- [ ] 3. A local solution has been provided
- [ ] 4. A pull request is pending review
Describe the bug
Stitching a remote schema loses any "extensions" information in the query response of a sub-schema
A GraphQL query response may have a top-level "extensions" field next to the "errors" and "data" fields:
https://spec.graphql.org/June2018/#sec-Response-Format
This "extensions" section can be used to provide auxilliary information such as profiling information or hints back to callers for performance optimization, or indeed anything else.
This information is lost when stitching in the remote graphql schema into a stitched global schema.
I would expect to be able to provide a merge function for the optional 'extensions' part of the response payload, with a default implementation which would naively merge the map contents.
I was able to track it down to this function, where extensions are lost https://github.com/ardatan/graphql-tools/blob/1d0e1b98c9451043f14bdc5201f483ab44226c91/packages/delegate/src/checkResultAndHandleErrors.ts#L48
but I'm not sure how to proceed.