Important information is missing on the schema-customization page #38243
Open
Description
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Summary
I am using a strapi plugin with complex types like Image and Dynamic zones. Sometimes a field did not have a value on any type and this would crash gatsby with an error.
The error I got was:
ERROR #85923 GRAPHQL.VALIDATION
There was an error in your GraphQL query:
Cannot query field "image" on type "STRAPI_ARTICLE".
To prevent this I wanted to use typedefs, but did not know how to correctly the types.
Until I stumbled upon actions.printTypeDefinitions.
This makes this process a lot easier when some fields are optional but initially not filled in.
The page I searched was: https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/
Steps to Resolve this Issue
- Please add some reference to actions.printTypeDefinitions in that page with an explanation that it can be used to infer types.
- And that to be able to use this correctly you would have to fill in every field once for the schema to be used in const typedefs.