microsoft/Graphir

Resovers throw exception while reference are null

Closed this issue · 1 comments

I am working on resolvers now, I am getting into an issue that when we try to fetch any related resource for a resource reference [with 1:1 cardinality ratio] which does not have any related resource (null) for any particular object, it is throwing an "object set to null reference" exception. I cannot return an empty object as well cos related resource's primary key required a value to be assigned. otherwise, it is throwing an error as "cannot assign a null value for a non-nullable type", any suggestions?

I am working on resolvers now, I am getting into an issue that when we try to fetch any related resource for a resource reference [with 1:1 cardinality ratio] which does not have any related resource (null) for any particular object, it is throwing an "object set to null reference" exception. I cannot return an empty object as well cos related resource's primary key required a value to be assigned. otherwise, it is throwing an error as "cannot assign a null value for a non-nullable type", any suggestions?

I changed NonNullableType Primary key to Normal Field, now I could return the empty Object if no referenced resource found