diff --git a/fastapi/openapi/docs.py b/fastapi/openapi/docs.py index 82380f85d..f7d8b6d50 100644 --- a/fastapi/openapi/docs.py +++ b/fastapi/openapi/docs.py @@ -110,51 +110,51 @@ def get_swagger_ui_html( [FastAPI docs for Configure Swagger UI](https://fastapi.tiangolo.com/how-to/configure-swagger-ui/) and the [FastAPI docs for Custom Docs UI Static Assets (Self-Hosting)](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/). """ - current_swagger_ui_parameters = swagger_ui_default_parameters.copy() + swagger_config = { + "url": openapi_url, + "dom_id": "#swagger-ui", + "layout": "BaseLayout", + "deepLinking": True, + "showExtensions": True, + "showCommonExtensions": True, + "presets": [ + "SwaggerUIBundle.presets.apis", + "SwaggerUIBundle.SwaggerUIStandalonePreset" + ] + } + if swagger_ui_parameters: - current_swagger_ui_parameters.update(swagger_ui_parameters) - - html = f""" - - -
- - -