mirror of https://github.com/tiangolo/fastapi.git
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
This commit is contained in:
parent
af895836ac
commit
8b1c9878bf
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
*,
|
||||
|
|
@ -211,13 +215,13 @@ def get_stoplight_elements_html(
|
|||
stoplight_elements_favicon_url: str = "https://fastapi.tiangolo.com/img/favicon.png",
|
||||
api_description_document: str = None,
|
||||
base_path: str = None,
|
||||
hide_internal:bool = False,
|
||||
hide_try_it:bool = False,
|
||||
try_it_cors_proxy:str = None,
|
||||
hide_internal: bool = False,
|
||||
hide_try_it: bool = False,
|
||||
try_it_cors_proxy: str = None,
|
||||
try_it_credential_policy: TryItCredentialPolicyOptions = TryItCredentialPolicyOptions.OMIT,
|
||||
layout: LayoutOptions = LayoutOptions.SIDEBAR,
|
||||
logo: str = None,
|
||||
router: RouterOptions = RouterOptions.HISTORY
|
||||
router: RouterOptions = RouterOptions.HISTORY,
|
||||
) -> HTMLResponse:
|
||||
html = f"""
|
||||
<!doctype html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue