From a35bc71e537aac5d7a3b38344fcd2f782a6c907f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Sun, 5 Feb 2023 19:53:19 +0100 Subject: [PATCH] Fix routes getting listed twice in API documentation (#2079) * remove duplicate tags from all routes after mounting * fix missing import --- mealie/app.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mealie/app.py b/mealie/app.py index 0687273d7481..9a6bd5788963 100644 --- a/mealie/app.py +++ b/mealie/app.py @@ -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():