GraphQL error: Non-nullable field was not present in result from Dgraph

I actually think this is best handled by a custom mutation that has the input restrictions.

For example, you could set the actual model to not require the author. That’s really what the types are about - what you expect a query result to have - which in this case is that the author might not be present in the result.

Then set a custom mutation where the input does require the author. That custom mutation just calls the add mutation as it’s implementation (maybe after some other data validation).

ATM, you’d need to deploy that custom mutation somewhere - another server, lambda function etc. But soon we’ll have the JS hooks and you should be able to define it as part of the schema easily.

2 Likes