Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support / adoption of GraphQL over HTTP spec 2.0 (e.g. non 2xx-Status Code for errors with application/graphql-response+json) #4334

Closed
frittentheke opened this issue Jan 27, 2025 · 2 comments

Comments

@frittentheke
Copy link

This is somewhat a mix of feature request and discussion ....
one which I also kicked off in spring-projects/spring-graphql#1113 // spring-projects/spring-graphql#783

I was just wondering about your take and support of the upcoming 2.0 revision of the GraphQL over HTTP spec , especially in regards to status codes.

The appropriate section about the application/graphql-response+json response type (https://graphql.github.io/graphql-over-http/draft/#sec-application-graphql-response-json) states:

If the GraphQL response does not contain the data entry then the server MUST reply with a 4xx or 5xx status code as appropriate.
The GraphQL specification indicates that the only situation in which the GraphQL response does not include the data entry is one in which the errors entry is populated.

Currently it seems as if there is no support / adoption of non-2xx HTTP response codes in graphql-js yet?

@JoviDeCroock
Copy link
Member

I am not sure what you are expecting here, GraphQL-JS is purposefully independent of the HTTP spec. Implementations like GraphQL-HTTP, GraphQL-Yoga, ... would implement this, this is the reference implementation of the general GraphQL Specification

@frittentheke
Copy link
Author

I am not sure what you are expecting here, GraphQL-JS is purposefully independent of the HTTP spec. Implementations like GraphQL-HTTP, GraphQL-Yoga, ... would implement this, this is the reference implementation of the general GraphQL Specification

My bad @JoviDeCroock -- I should much rather have looked at e.g. https://github.com/graphql/graphql-http?tab=readme-ov-file#servers

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants