-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): use embedded remote schemas #19504
Conversation
avoids additional layer of delegation
@freiksenet, what do you think? |
Hello @yaacovCR! So far it has been working with older version of graphql-tools. I wonder if you could provide motivation for moving to your fork, are there any use cases that this solves for gatsby-plugin-graphql? Thanks! |
ardatan/graphql-tools#1206 (comment) I highlighted one feature related to the use here of transformSchema, in fork you get to specify remote schema details within transform schema, so that there is only one wrapping outer schema, rather than two layers of delegation, with a speed improvement on my completely non representative test machine of about 15 ms. There is also fixed handling of errors from remote schema that should now be passed along appropriately, not sure how that is handled within Gatsby, whether that is something that can be taken advantage of, but it might be helpful! |
Thoughts? |
Of course, other benefits of the fork is that it supports multiple new transforms that allow you to modify objects types and fields other than root fields. The plugin could allow passing these options to the fork from Gatsby. On the stitching side, the fork supports merging fields from output types with identical names from multiple subschemas, which also might be useful! |
I'm very much in favor of switching to |
Maybe we could rename it to |
Holy buckets, @yaacovCR — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
We've got an issue after switching: #20015 We were using: const {
createResolveType,
fieldMapToFieldConfigMap,
} = require(`graphql-tools/dist/stitching/schemaRecreation`) Which was changed to: const {
createResolveType,
fieldMapToFieldConfigMap,
} = require(`graphql-tools-fork`) But looks like there are no exports like this in |
Reverting this for now. |
This reverts commit 588eaf7.
Sorry about that, the fork provides cloneSchema and cloneType methods that take the place of createResolveType. fieldMaptoFieldMapConfig is still there, but I don't think it is actually exported. New to development with Gatsby, however, could you point me perhaps to the right set of integration tests to run when touching this up? |
Fixed by #20042. |
Avoid additional layer of delegation.
Description
Switches to graphql-tools-fork, a maintained fork of the original repository with continued support for schema stitching. The fork allows for embedding a remote schema configuration within the call to transform schema, removing an additional layer of delegation within root fields and merging by defaultMergedResolver.