DeanWay / fastapi-versioning

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

Warning: "openapi_prefix" has been deprecated in favor of "root_path" #13

Closed p-rinnert closed 3 years ago

p-rinnert commented 4 years ago

First of all thank you for your work on the module! I really like what you are doing and its working great.

Describe the bug During startup of the API a warning message is shown (likely due to a change in FastAPI): "openapi_prefix" has been deprecated in favor of "root_path", which follows more closely the ASGI standard, is simpler, and more automatic. Check the docs at https://fastapi.tiangolo.com/advanced/sub-applications-proxy/ Might be a simple change here ?

To Reproduce Minimal example:

#example.py
import uvicorn
from fastapi import Depends, FastAPI
from fastapi_versioning import version, VersionedFastAPI

app = FastAPI()

@app.get(path='/example')
@version(1, 0)
def example():
    return 'test'

app = VersionedFastAPI(app) #here the warning is shown

if __name__ == "__main__":
    uvicorn.run("example:app",host="127.0.0.1",port=8000,reload=True,debug=True)

Warning message: Anmerkung 2020-07-07 144511

Not related to the bug I was happy to find that module is even doing more than you write in the readme: If a route is only specified in version v1_0 and not overwritten by a new version it is also available in newer endpoints (e.g. v2_0). For me this seems worth mentioning in the readme 👍

welcomemat-repo commented 4 years ago

Great package and makes the versioning very simple.

This warning appears only if we use this package. Hoping it would be fixed soon.

Thanks for your work.

synchronizing commented 4 years ago

22 Fixes the issue.