gatsby-source-drupal and using Drupal's Paragraphs module - need to edit schema so all paragraph types are queryable without error #30270
Unanswered
chris-bingham
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Tech Stack
Context
I am working on a site that uses Drupal as its sole datasource, we retrieve the data using the
gatsby-source-drupal
plugin. We are using Drupal's Paragraphs module to allow the site admins to add bespoke blocks to pages of any content type.The Issue
The problem we are having is that when no nodes of a specific content type use a specific paragraph type, that relationship wont be added to the JSON API and the graphql query will throw an error.
Simplified query:
Error:
The client needs the flexibility to use any amount of the paragraph types on any content types.
Fix that isn't working
I have tried using
onSchemaCustomization
ingatsby-node.js
to add a union type so that we can query for all paragraph types even if they are not used.Here's a simplified version of this with just a few paragraph types and one content type:
This allows us to query for all paragraph types without error and the gql schema looks correct. However when querying for
field_sections
it always just containsnull
. It should be an array of paragraphs or and empty array if the node has no paragraphs.Any help to fix this solution or other ideas would be so greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions