full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
API Versioned URL outside of api_v1 directory
/app/api/deps.py has a hardcoded and versioned url that lives outside the versioning setup of the api.
reusable_oauth2 = OAuth2PasswordBearer(
tokenUrl=f"{settings.API_V1_STR}/login/access-token"
)
This is loaded as a dependency of get_current_user() which is then imported into the versioned endpoints (i.e. app/api/api_v1/endpoints/). Maybe I'm missing something, but this seems like a mistake. It's not clear how one would then add a API_V2 and continue to use this arrangement without duplicating and moving get_current_user().
Do you have any guidance for this when bumping the api up to the next version?