You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The price and description fields has a null value for GraphQL library and this is not allowed since we declare a graphql.NewNonNull field. Indeed, we get the following error:
Cannot return null for non-nullable field price.
Cannot return null for non-nullable field description.
Temporary solution
The only way to fix this problem at the moment is to duplicate code:
I discovered this bug trying to resolve this problem #183 (comment) .
Essentially, this library does not allow to have anonymous fields for compositions since those fields are not evaluated.
Example
GraphQL schema
Result
The
price
anddescription
fields has anull
value for GraphQL library and this is not allowed since we declare agraphql.NewNonNull
field. Indeed, we get the following error:Cannot return null for non-nullable field price.
Cannot return null for non-nullable field description.
Temporary solution
The only way to fix this problem at the moment is to duplicate code:
Or changing a lot of things both internal and external (also the public fields to API consumers).
Instead of:
We have to provide this:
Both solutions are really limited and go against clean code.
The text was updated successfully, but these errors were encountered: