-
Notifications
You must be signed in to change notification settings - Fork 0
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
Research how best to handle schema customization #12
Comments
Generating schemas from Payload and passing to GatsbyTerminology
|
I tried using the generated GraphQL schema from
If I remove the custom schema and let Gatsby generate what it thinks is the schema, the blocks are a flat set of fields. Whilst this isn't an issue functionally, it does mean that the EDIT: I was able to get around this by utilising As the Gatsby docs don't show this at all, here's an example. createTypes([
...
schema.buildUnionType({
name: `PayloadBlockUnionABC`,
types: [
`PayloadBlockTypeA`,
`PayloadBlockTypeB`,
`PayloadBlockTypeC`
],
resolveType: (value, info) => {
if (value.blockType === "block-type-a") {
return `PayloadBlockTypeA`;
} else if (value.blockType === "block-type-b") {
return `PayloadBlockTypeB`;
}
return "PayloadBlockTypeC";
}
}),
...
]); |
References
Plugins that use GraphQL/schemas (other CMS implementations):
The text was updated successfully, but these errors were encountered: