Skip to content
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

Important information is missing on the schema-customization page #38243

Open
2 tasks done
fgroenendijk opened this issue Jun 15, 2023 · 0 comments
Open
2 tasks done

Important information is missing on the schema-customization page #38243

fgroenendijk opened this issue Jun 15, 2023 · 0 comments
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@fgroenendijk
Copy link

Preliminary Checks

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

  1. Please add some reference to actions.printTypeDefinitions in that page with an explanation that it can be used to infer types.
  2. 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.
@fgroenendijk fgroenendijk added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Jun 15, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

No branches or pull requests

1 participant