versionist
versionist copied to clipboard
Api_version route alias
Would it be possible to have an option allowing a route to have an alias for one or more api_version values possible.
For example. My API has a version 0.1.1, 0.1.2 and 0.1.3. And I would like that when I called version 0.1, it puts me in the scope of version 0.1.3.
api_version(:module => "V0__1__1", :header => "API-VERSION", :value => "v0.1.1") do
...
end
api_version(:module => "V0__1__2", :header => "API-VERSION", :value => "v0.1.2") do
...
end
api_version(:module => "V0__1__3", :header => "API-VERSION", :values => ["v0.1.3", "v0.1"]) do
...
end
It's certainly possible, just trying to understand the motivation behind this.
So you want calls for the generic minor version v0.1 to return the current patch version of v0.1.3. If you introduce v0.1.4, will you change the v0.1 alias to point to v0.1.4? If so, that would break your contract with clients (i.e. the endpoints and/or response payloads may have changed), no?
So, you understand my concern.
I develop an API for a project, and this API is used by several devices like iPhone app or web app mobile. So for a web app mobile, it's not a problem to change the version of api to call, because it's a web structure and it's easy to change this value. Whereas for the iPhone app, it's different because we can't easily updated it and it as a delay for an update to be approved by the app Store or Android Market.
I would like when I call minor version v0.1 alias, I benefit of the latest patch without returned structure changes and without changes parameters to send to the api. So for the iPhone app it's an advantage to call the minor version v0.1 and benefit of the latest patch without publishing the app on app Store again. And with this way, I think I don't break the contract with clients.