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
chore(gatsby-source-graphql): upgrade to graphql-tools v6 #24158
Conversation
Marking this as blocked until v6 is released, also assigning to @vladar who leads most of our graphql effort. |
21e1dfd
to
49ad437
Compare
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.
@yaacovCR Congrats with the v6 release of graphql-tools
! 🎉
The PR looks good to me but I need to try it locally before merging (and also check out the changelog of graphql-tools
). I will get back to you when I have a chance to do this. And thanks a lot for your help with migration to v6! 💜
Happy to help, I also noticed you seem to have to work around a few issues in GraphQL compose when you are rebuilding a schema... I wonder if using some of our utilities functions would help you out with that, as you can see from above, mapSchema let's you start from any initial schema and do the composition on built graphql schema objects. Not really sure why you are rebuilding, what has changed and what hasn't and whether this would help you but just figured I would flag it. We built some helper functions that can add types and modify object fields using the above approach, but there are additional possibilities that might help you as well. |
49ad437
to
386e59c
Compare
Upgrade to latest graphql-tools version, v6.0.9, also switched gatsby-recipes to use scoped packages for smaller bundle size. Fix of interest: ardatan/graphql-tools#1572 |
Note that I did not change the metadata recipe to use the newer functional directive approach. We are hoping to still provide backwards compatibility with the current approach. Also, populating metadata is still an unresolved issue overall, with the guidance from graphql-js to use the extensions field for graphql objects, but no built-in approach to populating it. I think that the eventual solution (possibly built on something like graphql-tools's functional directive approach?) should really be in graphql-js, and it seems counterproductive to iterate through multiple interim solutions. |
Sorry for the delay with this. We are having a company event this week, so I will revisit it the next week. Also can you please post a separate PR for |
Will do |
1b709cd
to
a6dd659
Compare
a6dd659
to
0e02f19
Compare
Hmmm, looks like Gatsby recipes changes made it, but not this one... |
Can you rebase or merge master? I am going to test it locally first thing tomorrow and then we can merge if everything is fine! |
# Conflicts: # yarn.lock
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.
Sorry for the delay, just got to testing. It fails for me with an error:
TypeError: executor is not a function
Here:
introspectionSchema = await introspectSchema(link) |
I belive it's because introspectSchema
expects executor vs link
now:
export async function introspectSchema(executor: AsyncExecutor, context?: Record<string, any>): Promise<GraphQLSchema>
Actually the fix was a quick one (just pushed). Trying to resolve conflicts and make the tests pass, which is harder :) |
# Conflicts: # yarn.lock
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.
Ok, works as expected after the quick fix. Let's merge this 🚢
Will publish it as a new minor
Published in |
* upgrade gatsby-source-graphql to graphql-tools v6 * Update yarn.lock * fix broken introspectSchema call * Update yarn.lock (again) Co-authored-by: Vladimir Razuvaev <vladimir.razuvaev@gmail.com>
Description
Upgrade dependency graphql-tools to v6
Major change is that in v6, graphql-js objects are considered immutable, hopefully leading to greater interoperability.
Pending release of v6.
Documentation
https://www.graphql-tools.com/