I’m having problems with structuring a content and using it using gatsby/graphql.
The scenario is this:
- I have a Product content Model that has an optional field that is a reference to another field, let’s call this optional field “Color”.
- Let’s say i create a product, and i leave “Color” empty.
- Now i go on my graphql queries i add color to my query fragment.
- If i query “All products” everything is good, i’ll get an array with all the products and the color field set to null
- instead if a query the single product Product($id) and I add in the query color, it fails compiling the query, cause it can’t find Color in the schema. It seems that contentful not returning empty field while querying a single resource. I would like to have all the fields available in my schema but if not set they should be null.
do you have any clue on how to solve this stuff?