We are developing a large CMS using contentful with gatsby. This contentful installation has 2 spaces due to legislative content reasons and a multitude of environments for developing new features. Currently our process flow is that we use contentful's migration tooling to create migrations for new content models and/or content model alterations in contentful and store them in source control. Upon merge, our CI workflows migrate these content model changes to the master environments of both our spaces.
An issue we've run into is that, due to a quirk of contentful's management API where any content model that doesn't have any content registers as not existing, we need to create seed content for some of our content model changes. This creates the following problems:
- Seed content that needs to reference existing content through ids will break between spaces as ids will differ
- If we spend a while developing a feature, our environments will fall behind the master env and updating our temporary development env can be time consuming and awkward depending on the level of changes to master
- We end up with a load of dummy content in our spaces, making our contentful spaces untidy
We are experimenting with a couple of solutions but the preferred one is to simply handle the errors from graphql validation ourselves. After a bit of experimentation with gql validation, removing a few of their internal rules, the call to contentful doesn't actually break the application. All breaking errors just come from the validation step. The ideal would be to "switch off" the validation rule NoUndefinedVariables
which is the only one causing us problems. By switch off I mean just display a warning over a breaking error. We would then handle undefined or empty values in the application ourselves.
I can't see any way to handle gql validation via gatsby's developer interface (gatsby-node, gatsby-config etc). What's the best way to handle this?