diff --git a/fastapi/applications.py b/fastapi/applications.py index 02db349f1..19e3215fb 100644 --- a/fastapi/applications.py +++ b/fastapi/applications.py @@ -24,9 +24,9 @@ from fastapi.logger import logger from fastapi.middleware.asyncexitstack import AsyncExitStackMiddleware from fastapi.openapi.docs import ( get_redoc_html, + get_stoplight_elements_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html, - get_stoplight_elements_html, ) from fastapi.openapi.utils import get_openapi from fastapi.params import Depends @@ -275,7 +275,11 @@ class FastAPI(Starlette): openapi_url=openapi_url, title=self.title + " - Stoplight Elements" ) - self.add_route(self.stoplight_elements_url, stoplight_elements_html, include_in_schema=False) + self.add_route( + self.stoplight_elements_url, + stoplight_elements_html, + include_in_schema=False, + ) async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: if self.root_path: diff --git a/fastapi/openapi/docs.py b/fastapi/openapi/docs.py index d54e0c35b..ded9883dd 100644 --- a/fastapi/openapi/docs.py +++ b/fastapi/openapi/docs.py @@ -1,6 +1,6 @@ import json -from typing import Any, Dict, Optional from enum import Enum +from typing import Any, Dict, Optional from fastapi.encoders import jsonable_encoder from starlette.responses import HTMLResponse @@ -187,20 +187,24 @@ def get_swagger_ui_oauth2_redirect_html() -> HTMLResponse: """ return HTMLResponse(content=html) + class TryItCredentialPolicyOptions(Enum): OMIT = "omit" - include = "include" + include = "include" SAME_ORIGIN = "same-origin" + class LayoutOptions(Enum): SIDEBAR = "sidebar" - STACKED = "stacked" + STACKED = "stacked" + class RouterOptions(Enum): HISTORY = "history" - HASH = "hash" - MEMORY = "memory" - STATIC = "static" + HASH = "hash" + MEMORY = "memory" + STATIC = "static" + def get_stoplight_elements_html( *,