Fix routes getting listed twice in API documentation (#2079)

* remove duplicate tags from all routes after mounting

* fix missing import
This commit is contained in:
Sören 2023-02-05 19:53:19 +01:00 committed by GitHub
parent f4b819899d
commit a35bc71e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import uvicorn
from fastapi import FastAPI
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.routing import APIRoute
from mealie.core.config import get_app_settings
from mealie.core.root_logger import get_logger
@ -78,6 +79,12 @@ def api_routers():
api_routers()
# fix routes that would get their tags duplicated by use of @controller,
# leading to duplicate definitions in the openapi spec
for route in app.routes:
if isinstance(route, APIRoute):
route.tags = list(set(route.tags))
@app.on_event("startup")
async def system_startup():