diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f282324..41e075063 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ And **SDNQ** improvements: now with *NPU* support and its own native *attention* - log: strip ansi sequences from ring buffer and client side logging - model metadata: handle invalid metadata and strip workflows - ui debounce aspect-ratio linked width/height controls + - api: stricter api request and response schemas + - api: openapi schema exposure ## Update for 2026-06-16 diff --git a/modules/api/docs.py b/modules/api/docs.py index 78186f164..208bf3a56 100644 --- a/modules/api/docs.py +++ b/modules/api/docs.py @@ -66,7 +66,7 @@ def create_docs(app: FastAPI): "dom_id": "#swagger-ui", } - @app.get("/docs", include_in_schema=True) # override for the default fastapi swagger route + @app.get("/docs", include_in_schema=False) # override for the default fastapi swagger route async def custom_swagger_html(): res = get_swagger_ui_html( title=f'{app.title}: Swagger UI', @@ -79,7 +79,7 @@ def create_docs(app: FastAPI): def create_redocs(app: FastAPI): - @app.get("/redocs", include_in_schema=True) # override for the default fastapi redocs route + @app.get("/redocs", include_in_schema=False) # override for the default fastapi redocs route async def custom_redoc_html(): res = get_redoc_html( title=f'{app.title}: ReDoc', diff --git a/webui.py b/webui.py index 39bfa5ed1..4e86da149 100644 --- a/webui.py +++ b/webui.py @@ -67,8 +67,7 @@ fastapi_args = { "description": "SD.Next", "docs_url": None, "redoc_url": None, - # "docs_url": "/docs" if cmd_opts.docs else None, # custom handler in api.py - # "redoc_url": "/redocs" if cmd_opts.docs else None, + "openapi_url": "/openapi.json" if shared.cmd_opts.docs else None, # only expose OpenAPI schema if docs are enabled }