fastapi-cache
fastapi-cache copied to clipboard
Response model is missing in the OpenAPI spec and Swagger for @cache decorated endpoints
I've noticed, that response model is missing in the OpenAPI spec and Swagger for @cache decorated endpoints unless response_model
is specified explicitly in the endpoint handler decorator, which is optional for newer versions of FastAPI. Specifying return type annotation of a handler function should be enough.
Versions (from pyproject.toml):
- fastapi-cache2 = {git = "https://github.com/long2ice/fastapi-cache.git", extras = ["redis"]}
- fastapi = "^0.101.0"
Thank you for your feedback, I will try to fix it.
I also noticed that, as a workaround I added response model to route:
@router.get("/{package_name}", response_model=FetchEntitiesPartitions)
but this is code repetition..