[openstreetmap/openstreetmap-website] [WIP] Supporting multiple API versions (#2353)

Andy Allan notifications at github.com
Thu Aug 22 09:10:07 UTC 2019


>  I was wondering a bit how you would handle evolutionary or even revolutionary changes to the data model.

I can sum this up with the phrase "it depends"!
* Different versions of the API can use different views, so if we added something to a future api (for example "node coordinate precision" or somesuch) it can be shown in the latest version and ignored in previous versions, or shown in a different way (e.g. as tags).
* Different api versions can use different controllers too, as already demoed in this PR for the capabilities controller. This allows more subtantial changes in behaviour between api versions, and changes like fixing response codes.
* We could use different models too. I'm not sure why we'd want to, but e.g. api/0.7/node/1 could call a node_controller that fetches data from the ShinyNewNode model.

But it all really depends. I think the underlying question might be "how do we handle drastically non-backwards-compatible changes, like converting all closed ways into an area type (or if we introduce an area type into API N+1, how does that work with API N clients); or how would a change like removing segments work with two api versions running in parallel. I don't have an answer for these major structural changes, except to say that if it's logically possible at all to access the data between versions, the code approach in this PR will be able to handle it. And perhaps there'll be some change to the datastructure that prevents parallel API versions and it'll trigger a hard cutover between versions.

But lets not get stuck on the biggest problem, and one that's not yet in hand. In the meantime, there's a ton of backwards-compatible but needs-API-bump changes that have been stuck for years, so we can at least sort out those ones :smile:

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/2353#issuecomment-523820493
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190822/ae7e9023/attachment.html>


More information about the rails-dev mailing list