Skip to content
Discussion options

You must be logged in to vote

The whole point of having a v2 is usually to enable a different API without breaking existing clients.
Since for v1 you need to keep the existing schema and for v2 you want a different schema, using a shared schema is risky, because you might end up breaking v1 while changing for the new v2.

What you might want to consider is refactoring v1 implementation to an adaptor above v2 - translate the v1 schema to v2 schema and call the underlying v2 logic, then translating the v2 response back to v1. You could also use this technique to map from v2 to a non-FastAPI based model for your storage/business-logic and back, thus isolating your storage/business-logic model from your API model.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@DannyVarod
Comment options

Answer selected by YuriiMotov
@davidegraff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants