CodePark/ questions / GraphQL, gRPC & REST
START PRACTICINGPRACTICE
Backend question · HTTP & API design › GraphQL, gRPC & REST

A GraphQL query asks for user and orders. The orders resolver throws. What does a typical GraphQL server return?

A 200 response with data.user filled, data.orders set to null, and an errors array describing the failure

The server returns "a 200 response with data.user filled, data.orders set to null, and an errors array". GraphQL supports partial results:
• Fields that resolved are returned in
data.
• The failed field becomes
null, if the schema allows it to be null.
• The failure is described in the
errors array.

The status is often still 200, so "a 500 status with no data" is wrong. This also means that monitoring status codes alone misses GraphQL errors.