leangen / graphql-spqr

Build a GraphQL service in seconds
Apache License 2.0
1.09k stars 181 forks source link

Errors element must not be present when empty #96

Closed ricardomercado closed 6 years ago

ricardomercado commented 6 years ago

Hello, Not sure if this is a big ask, but according to the GraphQL spec, the errors element in the response should only be present if it contains error data. This is not a big deal for most uses, but it can break some client libraries like Apollo, which adhere strictly to the spec.

kaqqao commented 6 years ago

Did you forget to call ExecutionResult#toSpecification? That produces a spec-compliant map that you're supposed to send to the client.

Either case, SPQR neither executes the query nor constructs the result - graphl-java does that - SPQR only generates the schema.

kaqqao commented 6 years ago

See the sample as well.