-
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
[FOR DISCUSSION] Expose GQL Union possibilities #2990
Conversation
Deploy preview ready! Built with commit 675afcb |
Deploy preview ready! Built with commit 675afcb |
Deploy preview ready! Built with commit e0ab383 |
Deploy preview ready! Built with commit e0ab383 |
Deploy preview failed. Built with commit fbaad4e https://app.netlify.com/sites/using-glamor/deploys/5a1c3fb44c4b935d370b3230 |
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.
Super interesting!
This seems like a pretty plausible way to add support for this sort of thing.
Have you looked at Schema stitching yet? We really need support for that to make it easier for people to pull in existing GraphQL schemas. Probably doesn't need to be done in this PR but an additional thing to be considering https://dev-blog.apollodata.com/graphql-schema-stitching-8af23354ac37
* Run after the schema has been created but before it's dispatched allowing you | ||
* to do cool enhancements e.g. union / interface stuff | ||
*/ | ||
exports.enhanceSchema = true |
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.
Per the API specification, this should be setSchemaFields
https://www.gatsbyjs.org/docs/api-specification/#operators
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.
Actually, let's make this createSchemaFields
. There's no reason to allow people to override the default fields so we should validate against that.
@uttrasey you think you'll have time soon to finish this up? |
I've not had a chance to finish the site implementation and think it should wait for that. It's going to be a push for this year. We could close and re-open next year? |
Nah, not a big deal. We can leave it open. |
Hey, closing out old PRs. Would love to see you or someone else pick this up and carry it to the finish line! |
Raising a super rough PR to get early feedback.
Following on from the discussion here #2775 I've proposed a new API to allow sites/plugins to manipulate the GQL schema to do cool stuff. In my case I wanted to add a Union type which would allow me to query for 2 types at the same time. This has been achieved (very roughly) over here uttrasey/gatsby-union-demo#2
Assuming a path exists forward I'm keen to hear thoughts if it's possible to make use of some of the awesome stuff available in build-node-connections for filtering, paging, sorting etc.
What do folks think?