Allow versioning at path:method level
See original GitHub issueTo facilitate the option of media-type versioning, it would be helpful to version at the path:method level. Here is the gist of my proposal: move version from root level to path:method level and represent as an array of versions. In making the change as described, my hope is that none of the existing functionality is sacrificed.
Single version example
/pets/{id}:
put:
tags:
- "pets"
versions:
- version: "default"
summary: "..."
description: "..."
... all other properties formerly defined in the path-item
Multiple version example
/pets/{id}:
put:
tags:
- "pets"
versions:
- version: "1"
summary: "..."
description: "..."
operationId: "updatePet_v1"
consumes:
- "application/json"
- "application/vnd.vendor.v1+json"
deprecated: true
... all other properties currently defined in the path-item
- version: "2"
summary: "..."
description: "..."
operationId: "updatePet_v2"
consumes:
- "application/vnd.vendor.v2+json"
... all other properties currently defined in the path-item
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:8 (2 by maintainers)
Top Results From Across the Web
API versioning methods: A brief reference - Red Hat Developer
This article provides a comprehensive list of the methodologies used for versioning your API.
Read more >Four REST API Versioning Strategies - xMatters
One way to version a REST API is to include the version number in the URI path. xMatters uses this strategy, and so...
Read more >How to Version a REST API - freeCodeCamp
URI path versioning implies orchestrated releases of application versions that will require one of two approaches: maintaining one version while ...
Read more >API Versions - ServiceNow Developers
Versioning is enabled at the API level and is applied to all API Resources. To enable versioning, click the Enable versioning related link...
Read more >How to manage REST API versioning with spring?
The idea is that the VersionRange annotation can define an open or closed version range. The first method is valid from versions 1.0...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I understand that this issue/feature request is still unresolved.
Still, I’m wondering: what is the current best practice? Path versioning should be quite common when your API starts to grow, so perhaps I’m misunderstanding some part of the specification, while the solution is obvious to others?
@gadton Thanks for pointing out another deficiency in the current 3.x spec with regards to media type versioning. To ensure I completely understand, let me restate.
Consider media-type versioning with the current 3.x spec:
In the above scenario, it is unclear what request content-type/response content-type combinations are legal. The best we could do is add a 406 response code with documentation indicating valid combinations. However, a move to versioning at the path:method level, we get this:
The intent is clear.