I have a GraphQL query that calls a REST service to get the return object. The query contains an Id parameter that is then passed to the service. However, the REST service can respond with http status 404 Not Found if an object with that Id does not exist. That seems like the right response.
How do you model a Not Found response in GraphQL? Is there a way to inform the GQL caller that something does not exist?
Update
Some options I am considering:
- Return null
- Change the GrqlhQL Query to return a list of objects and return empty list of nothing is found
- Return some kind of error object with an error code
but it is unclear if there is a recommended practice in GQL API design.