stockpile-co / api

The API for Stockpile, an app that manages stuff for organizations.
0 stars 1 forks source link

Fix versioning not being backwards-compatible #318

Closed AdamVig closed 7 years ago

AdamVig commented 7 years ago

Currently, the rental endpoint is supposed to serve different responses for API version 1.0.0 and 2.0.0, and all other endpoints are supposed to serve the same response for both of those versions. However, changing the overall version of the API to 2.0.0 causes all requests with Accept-Version: ^1.0.0 to fail because all endpoints default to the API version of 2.0.0.

For the time being, the production server has the version changed back to 1.0.0.

AdamVig commented 7 years ago

A possible fix could be to supply an array of versions that routes should work for by default (as in, [1.0.0, 2.0.0]) and set that on every route that doesn't specify a version explicitly. This would allow routes without an explicit version to accept requests with Accept-Version of both the current, latest version and previous versions.

This fix could be applied in ./controllers/routes.js.