Closed Acerinth closed 3 years ago
I was scratching my head on this for a bit. I also could not get the metadata to show up properly in the FastAPI docs. You may have fixed it already, but the solution for me was to add openapi_tags=tags_metadata,
to the app=FastAPI().
Like this example:
app = FastAPI(openapi_tags=tags_metadata)
The app
declaration has to come after your tags_metadata
.
As a side note, there are a lot of other metadata you can add, FastAPI Docs.
Hey @davidkartuzinski , thanks for your response! Unfortunately, meanwhile I had to quit using the library as it was impossible for me to run tests with it - to be more precise, dependency overrides weren't working as expected and I could not override my database info for the tests :(
But let's assume your answer would be correct, so I will close the issue :)
@Acerinth - Cool. I understand. In case you're interested, I have tests set-up like this: https://github.com/open-apprentice/ellie-platform/blob/main/tests/test_app.py. I am still new to testing but this does work. I am using Postgres for my production DB and sqlite for testing.
First of all, thank you so much for this extension, saved us a lot of additional unnecessary work!
Bug description Looks like description from tags metadata is not loaded/visible on OpenAPI docs, even if I pass it directly to
VersionedFastAPI
constructor. name is loaded, but description not. I haven't checked externalDocs attribute yet.To Reproduce Here is the part of the code from my
main.py
:... and in the
product_router.py
, I have defined:... and the same way in
camera_router.py
.Expected behavior How it should look like, is described here: FastAPI-Metadata. When I turn off
fastapi-versioning
, everything works like expected.Environment
Thanks!