Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning removes openapi tags / tag metadata. #57

Open
jterblanche opened this issue Sep 6, 2021 · 0 comments
Open

Versioning removes openapi tags / tag metadata. #57

jterblanche opened this issue Sep 6, 2021 · 0 comments

Comments

@jterblanche
Copy link

jterblanche commented Sep 6, 2021

Describe the bug
Firstly a HUGE thanks for this.
Using tag metadata as per Metadata and Docs URLs
When implementing VersionedFastAPI, original openapi tags / tag metadata disappear from openapi.json

To Reproduce

from fastapi import FastAPI
from fastapi_versioning import VersionedFastAPI
import uvicorn

tags_metadata = [
    {
        "name":"root",
        "description":"Root description here" 
    }
]
original_app = FastAPI(title="Items API", description="API for Items in the database.",  openapi_tags=tags_metadata)
@original_app.get("/", tags=["root"])
def root():
    return {"root":"hello"}

versioned_app = VersionedFastAPI(original_app, version_format='{major}', prefix_format='/v{major}', enable_latest=True, openapi_tags=tags_metadata)

if __name__== "__main__":
    uvicorn.run(original_app, host="0.0.0.0", port=8000)
    # uvicorn.run(versioned_app, host="0.0.0.0", port=8000)

If you run uvicorn.run(original_app, host="0.0.0.0", port=8000), Root description here appears in openapi.json as expected.
If you run uvicorn.run(versioned_app, host="0.0.0.0", port=8000), Root description here disappears from openapi.json

Expected behavior
Expected openapi tags to carry over to versioned api.

Additional context
Thanks for the versioning module - aside from this issue it has been awesome!

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

No branches or pull requests

1 participant