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.
Uh oh!
There was an error while loading. Please reload this page.
-
In graphql-workshop, the
xxxByIdfunctions (e.g.SpeakerById) definesnon-nullablereturn types. This results to an error when the entity with the givenidargument was not found.The Relay's spec says that we should return
nullinstead: https://relay.dev/graphql/objectidentification.htm#sec-Node-root-fieldShould we encourage implementation that returns
nullfor such cases?Beta Was this translation helpful? Give feedback.
All reactions