Should we encourage returning null when id
passed to xxxById
was not found?
#3123
Replies: 1 comment
-
All is about how you define query response... It is up on you... The relay spec says if there is error return Don't take workshop as way how the program your app. This workshop is introduction to HC server and give you easy overview.. Some stuff are just dummy and simplified for people to understand quick and should not be used in that way if you wanna have robust GQL server.. So take principles from workshop... |
Beta Was this translation helpful? Give feedback.
-
In graphql-workshop, the
xxxById
functions (e.g.SpeakerById
) definesnon-nullable
return types. This results to an error when the entity with the givenid
argument was not found.The Relay's spec says that we should return
null
instead: https://relay.dev/graphql/objectidentification.htm#sec-Node-root-fieldShould we encourage implementation that returns
null
for such cases?Beta Was this translation helpful? Give feedback.
All reactions