graphql-dotnet/server

Return 400 in case of validation errors?

sungam3r opened this issue · 7 comments

This surprises me a bit https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#document-validation

The server SHOULD deny execution with a status code of 400 (Bad Request).

Now server just calls IDocumentExecuter.ExecuteAsync and then writes response (ExecutionResult) with 200 OK. I'm 100% sure that switching from 200 to 400 will break a lot of out services. ping @Shane32

It is a configurable option in my implementation right now.

ExecutionResult.Executed to the rescue!

Hmm actually … well I need to check ….

Oh yeah it is. However for batched requests it always returns 200 because some requests may have executed successfully.

Side note - I think that we should not spend to much energy trying to jump around all nuances of batching. It's a sort of advanced feature out of official specs and it may be implemented in many ways.

Completed, right?

Yes