DeanWay / fastapi-versioning

api versioning for fastapi web applications
MIT License
650 stars 63 forks source link

Transformation-based versioning #17

Open languitar opened 4 years ago

languitar commented 4 years ago

Is your feature request related to a problem? Please describe.

Maintaining multiple API versions explicitly in the code base results in higher maintenance costs with each additional version that is kept alive. This blog post by stripe explains an interesting idea of countering this fact by representing versions via transformations to the responses instead, such that the code base, apart from declaring the transformations, only has to deal with the most recent API versions and all other versions are implicitly generated through the chained application of transformations.

Describe the solution you'd like

It would be cool if fastapi-versioning (or potentially another module) would realize a transformation-based approach to recude the long-term costs of maintaining multiple versions in parallel.

Additional context

I could find an implementation of this pattern for the django rest framework: https://github.com/mrhwick/django-rest-framework-version-transforms/tree/dev/tests. This could serve as an inspiration.