This commit is contained in:
Shahar Ilany 2022-07-18 23:13:15 +03:00
commit 1a07fa8965
2 changed files with 16 additions and 8 deletions

View File

@ -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:

View File

@ -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(
*,