-
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
Infer input fields from setFieldsOnGraphQLNodeType #2075
Infer input fields from setFieldsOnGraphQLNodeType #2075
Conversation
Deploy preview failed. Built with commit 73ebcc5 https://app.netlify.com/sites/using-glamor/deploys/59b562b8cf321c7aaed3fe17 |
Deploy preview ready! Built with commit 5127fa1 |
Hey! From a quick read through everything looks very sensible & workable. Thanks! Would love some tests for the new functionality. The reason there's not any existing tests is core to this point has had nothing to do with |
Good, no problem. It would really help if you can show me how to add usage of |
@Zalastax awesome! Basically what you want to do is simulate creating various schemas with different GraphQL types using Some of the tests in here should be a good guide: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby/src/schema/__tests__ |
Happy to answer more questions about the process as you dive in! |
How do I mock |
No need to mock it, that's overkill. Just manually add additional GraphQL fields that aren't in the node data. |
But I need https://github.com/Zalastax/gatsby/blob/0f8bffaaac491cd0ed015f7764e8acd2289bade0/packages/gatsby/src/schema/build-node-types.js#L129-L133 to get a list of fields to add? Sorry if I'm missing something. |
There's nothing special about that code. It just calls plugins and gets an array of graphql fields. You're testing the inference code not how gatsby gets fields from plugins. |
* Add tests * Strengthen error recovery for objects
@KyleAMathews I'm quite happy with this now 😃. Tell me if you need something more before merging. |
Hey this looks really really good! Thanks for adding this! Some tricky code but definitely fills in a big missing piece to Gatsby's GraphQL story 🙏 |
Hiya @Zalastax! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
Makes fields added by
setFieldsOnGraphQLNodeType
filterable and sortable.I didn't see any uses of
setFieldsOnGraphQLNodeType
in the tests so adding new tests felt like a non-starter.Closes #1931