-
Notifications
You must be signed in to change notification settings - Fork 60
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
"application/graphql" as official MIME type #31
Comments
A couple of notes:
So I have marked this issue as |
Hi! I have a few concerns about the concept of required 1 (process): My understanding is that this working group is prescriptive in designing new features for GraphQL over HTTP (like incremental delivery) but most descriptive for specifying existing basic features. The idea of adding in 2020 a MUST requirement (servers MUST process 2 (is this new type a good idea): I personally think a very nice thing about GraphQL HTTP/JSON servers is that it's pretty simple to implement them at the transport level. I like that you can typically use your web server's JSON support without any special configuration as part of implementing them. In Apollo Server 4 we're planning to decouple our code from your web framework a bit and put integration back in the hands of the user. Having to require everyone to figure out their web framework's JSON parser's content-type configuration options to be spec-compliant is a bit of a bummer. 3 (request vs response): If we do believe that we need special MIME types at all (which I'm not really convinced by), it doesn't make sense to me to use the same MIME type for requests and response. Other than being JSON, these types share no structure at all. One of them contains things like |
Apollo has been participating here since at least 2019, so it's not clear why Apollo Server would feel out of the loop: https://github.com/graphql/graphql-over-http/commits?author=abernix Apollo engineers have been encouraged all along to attend these public meetings. We've already had many hours of formal, detailed discussion around all the points you are raising now, and eventually arrived at a fairly strong consensus. You're right though that time is dragging on, and I don't know about the other participants but I'm starting to get rusty about the details that were discussed a few years ago. I have confidence in the due diligence that was applied at the time, but I can see how someone who wasn't present might not due to the spec still having a preliminary status. Personally, my participation tapered off because the meeting times became unsustainable for me here in Australia regarding timezone, but also because I switched focus to other problem spaces. I do plan to return to GraphQL servers beyond just maintenance at some point; most likely to implement solutions for Deno. Then compliance with and tooling around this spec will be a focus again and after brushing up on it I might be able to contribute again to progressing its status. |
Some historical context; here's some notes from when we brought it to the GraphQL Spec WG: https://github.com/graphql/graphql-wg/blob/main/notes/2020-04-02.md#applicationgraphql-media-type-status-10m-benjie
@glasser This was our original plan, however the
|
@benjie Thanks for the context. I see this in the notes:
At what point was it decided that the single mimetype should represent both server response and client request (two objects with no fields in common)? I think I'd agree with the "not clear" above. (That said, changing GraphQL servers to start serving |
I'd personally be much more excited about a spec that said that servers should return application/json by default but should also return application/graphql+json if requested by |
@glasser If memory serves; it was discussed in that WG, I was in favour of separate content types but was ultimately convinced that using the same content type and the keys to differentiate was sufficient - if it had
I'm surprised this isn't the status quo; if the client specifically only accepts |
Having just re-read that part of the spec, I agree with you that it should be rewritten. Cliffnotes:
|
I think I like most of those, though the last bullet seems challenging. My feeling is that there are even more GraphQL clients out there than GraphQL servers (given that it's easy for a GraphQL client to just be "no library, just write the HTTP request yourself") so requiring a naive client (that isn't specifying The above is all about responses; I am still not really sure why it is valuable to have a special type for requests. For responses we are talking about differentiating between JSON from "the GraphQL library" from JSON from "random other stuff in the HTTP proxy pipeline" but for requests, I'm not sure there's a real equivalent of "other random JSON that might be POSTed to a GraphQL endpoint". |
Yep, basically it should work in general, and if it doesn't then the server MAY return
Since they have a defined structure, I think it makes sense for them to have a type. |
If we release this spec in RFC format (even with "information" status) we can register
application/graphql
as official mime type:https://www.iana.org/assignments/media-types/media-types.xhtml
Combining it with
+json
structural suffix we can useapplication/graphlq+json
as media to for GraphQL request/responses in serialized as JSON.Prior Art:
application/grpc+json
, see https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#requestsapplication/soap+xml
, see https://en.wikipedia.org/wiki/SOAP#Example_message_.28encapsulated_in_HTTP.29I don't think it should go into
1.0
release but I think it's something we should explore for post-1.0
.The text was updated successfully, but these errors were encountered: