Skip to content

Consider simplifying the specification? #329

Open
@martinbonnin

Description

@martinbonnin

There has been a lot of discussion lately about how to handle the Accept header and response Content-Type.

2 recent examples:

The current draft of the specification splits the "response" section in 2 depending on whether the content-type is application/json or application/graphql-response+json. There is also a watershed in both the request section and the response section.

I understand the original (circa 2018) intent of the spec was to accurately describe the status quo and provide a foundation to build upon. As time has passed, we have realized the need to change this status quo, most importantly around Content-Types and HTTP status codes.

The result is we have now an hybrid spec with older (but still used) parts as well as newer (mostly unused but desired) parts. And a watershed to signal the transition.

All of this is non-negligeable mental load and will require some amount of education.

Since this is a new spec, we have a unique opportunity at a blank page and starting from that complexity feels a bit like a missed opportunity. It's not like we would make a breaking change, there was just nothing before!

What would be anyone's toughts if we simplified the specification to only mention the target (desired) end state?

It doesn't mean that servers would stop working. Old software would technically become non-compliant but implementers can decide to adopt the new specification on their own timeline. Probably for the major frameworks out there we can even reach out and make sure this happens before the actual spec release.

The spec could also add a non-normative note along the lines of below to help implementers who still want to maintain backward compatibility:

Prior to this specification, it was common practice to use the mime type of application/json and return a status code of 200 
no matter the contents of the response. There were also very few implementations that would return other status codes in 
the 4xx and 5xx range on errors.

We recommend that client implementations should check for the application/json  header for the foreseeable future and handle
it less strictly, until server implementations had time to adopt this specification.

Similar, server implementations might want to answer requests for an application/json differently, albeit the timeframe for 
migration here might be much shorter. 

In the long run, it's less complexity for everyone and also a clearer message for the community at large and non-GraphQL experts. Any thoughts? @benjie @Shane32 @enisdenjo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions