Cannot return null for non-nullable field
Hi Guys,
I have an attribute in a resource that is a jsonb object in postgres and am defaulting it to an empty object in the db and also want to return it as an emoty object in GraphQL. However it seems to be returning null if the the object is empty...
Is this something AshGraphQL is doing under the hood?
4 Replies
🤔 interesting
it shouldn't be
The first thing to check is that it works the way you expect outside of graphql
i.e write an equivalent query using Ash and run it, and make sure you're not getting back
nil
I had this problem before because of field_policies in case you are using those
code interface query returns an empty map. I am not using any field_policies
ok, interesting. It is the way I am building up the query I think
It is a pretty complex one where I needed to inject extra args in a related query
If I query a resource directly it works, but it seems that in the relation it gets lost
I'll dig up some examples
Ok, I think it is because of a calculation I'm doing
ok, problem seems to be between chair and keyboard... I'm just not adding it there... 🤦♂️
Whats your calculation?