Replies: 1 comment 1 reply
-
Versioning stuff (not just APIs) is a best practice, no-one will seriously debate that. And versioning is not limited to APIs. To be crystal-clear: versioning is good and everyone should do it. But while I agree on the merits of versioning per se, I strongly oppose making this a rule (and would likely -1 such a TRG-pull-request) for the following reasons.
Besides, arguments 4 and 5 of "Why in the URL" are invalid, as we are talking about machine-consumable APIs, which cannot be tested in a browser. Further, every developer will confirm that setting a header in code is no more difficult than setting a URL. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Note: This discussion relates to the pull request TRG API Versioning #526. The pull request has been updated after the first round of discussion in order to include the feedback.
Overview
The proposed TRG adds a rule that all (with some exceptions) APIs should be versioned by adding the version information of the API into the URL.
Furthermore, the TRG makes some recommendations on how to deal with versioning and related aspects.
Why
This TRG has been proposed in order to have alignment across Tractus-X, have good Developer experience for outside contributions and usage, easy / fast onboarding to have more traction.
As backward compatibility is required by the association in the Life Cycle Management 101 Whitepaper, therfore this overall guardrail needs to be translated to actual technical requirements.
Versioning APIs helps to transitions between major versions as you can continue to offer old API versions for a period of time. But even if the old API version is no longer supported, having versioned APIs helps to avoid endpoints beeing bothered with invalid requests from old clients and gives those client proper error messages in order to identify the issue.
If an API is not versioned, the clients might assume that the API is not going to include breaking changes and might therefore not be prepared. For this reason, it is more difficult to introduce a breaking change into an unversioned API. Therfore, it is industry best practice to version APIs from the very begining and this practice is followed by the TRG.
Why in the URL
The TRG requires the version information to be included into the URL. Alternatively, versioning could also be done using the HTTP header. However, the TRG has opted for URL-based versioning for the following reasons:
Why not optional
In the previous discussion on the TRG it was discussed if the TRG could make recommendations instead of a rule.
I prefere a rule instead of a recommendation for the following reasons:
That said, I understand that if we implement protocols defined elsewhere (e.g. DSP), the regulations might be conflicting. In the latest version of the TRG, I have therefore included a statement to explain what should and what shouldn't be covered by TRG. For example, I completly understand that the TRG should not apply to DSP and IATP, both need to come up with an own solution to tackle the issue of compatibility.
Why this discussion
This TRG has been discussed on the tractusx-dev mailinglist and in an office hour before. Since no agreement could be reached, it was decided to create this discussion in order to give more people the chance to participate in the discussion. So please feel free to share your thoughts.
Beta Was this translation helpful? Give feedback.
All reactions