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
I have a federated schema where you can message someone about an item on a site. On a long enough timeline, it may be that one of the items becomes unavailable and, thus, would return null in __resolveReference. However, the messages service would still hold a reference to it.
All things being well, this runs fine. However, if my item resolver in messages returns { id: 'item that has now been deleted' } and __resolveReference now returns null, this causes an error if I was trying to query any mandatory fields on the returned Item (i.e. title is required).
I would expect that returning null from __resolveReference would override the { id: 'item that has now been deleted' } but it seems to be merging with that and then causing me problems!
So would you expect in this instance, rather than my __resolveReference returning null, should it return a representation that is like { id: 'item that has now been deleted', title: 'No longer available' } or is there something I can do essentially where my item resolver and __resolveReference are merged, in order to say "if __resolveReference is null, return null for everything"?
Sorry if this is something that's been asked before - I've searched around a lot but I feel like I'm not using the correct terms because I feel like it's a fairly common usecase! Thank you in advance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a federated schema where you can message someone about an item on a site. On a long enough timeline, it may be that one of the items becomes unavailable and, thus, would return
null
in__resolveReference
. However, the messages service would still hold a reference to it.In my messages resolver:
In my Item resolver:
All things being well, this runs fine. However, if my
item
resolver in messages returns{ id: 'item that has now been deleted' }
and__resolveReference
now returnsnull
, this causes an error if I was trying to query any mandatory fields on the returned Item (i.e. title is required).I would expect that returning
null
from __resolveReference would override the{ id: 'item that has now been deleted' }
but it seems to be merging with that and then causing me problems!So would you expect in this instance, rather than my
__resolveReference
returningnull
, should it return a representation that is like{ id: 'item that has now been deleted', title: 'No longer available' }
or is there something I can do essentially where myitem
resolver and__resolveReference
are merged, in order to say "if__resolveReference
is null, return null for everything"?Sorry if this is something that's been asked before - I've searched around a lot but I feel like I'm not using the correct terms because I feel like it's a fairly common usecase! Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions