Skip to content

Revisiting versioning strategy of the JSON API spec #432

@hhware

Description

@hhware

(1) AFAIK, versioning strategy of JSON API spec is intentionally left undefined. IMHO, since the spec does have versions (1.0, RC2, etc. are being widely referenced), it would be useful to specify how these labels are constructed.

Proposal: add "JSON API is versioned according to the specification of Semantic Versioning" somewhere in the Introduction. If SemVer is adopted, 1.0 should obviously become 1.0.0.

(2) Even though JSON API will not be introducing backward-incompatible changes after 1.0, nothing prevents it from introducing significant changes in a backward-compatible manner, possibly multiple times over the years. When a client-side library implementing JSON API 1.N is processing a response from a server implementing JSON API 1.M, where N is much higher than M, that client should be able to guess availability of features available on the server from the response format. However, it could be argued that knowing M first-hand from the server could simplify the job of the client.

In addition to that, if it so happens that JSON API actually decides for some reason to introduce backward-incompatible changes in the future, despite the current intentions not to ever do that, transition will be much easier for clients if version of the format is always explicitly communicated. IMHO, it does not hurt to be cautious, especially if the only expense in this case is to add a few characters to headers...

Proposal: require that both client and server advertise JSON API version they are using via media type parameter, for instance:

Content-Type: application/vnd.api+json; json-api-version=1.0.0

(3) If (2) is accepted, it could be immediately useful for those who have already started using JSON API: the draft was out in the wild for almost two years! For example, the project which I am involved in uses pre-RC2 JSON API spec and advertises Content-Type: application/vnd.api+json. Since RC2, our system is formally incompatible with JSON API, but we cannot even change content type now because of the existing integrations with clients, etc. This would quickly solve this petty problem of ours:

Content-Type: application/vnd.api+json; json-api-version=1.0.0-rc.1

I would be glad to submit a PR for any/all of this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy