Home / Function/ get_swagger_ui_html() — fastapi Function Reference

get_swagger_ui_html() — fastapi Function Reference

Architecture documentation for the get_swagger_ui_html() function in docs.py from the fastapi codebase.

Function python FastAPI Applications calls 1 called by 5

Entity Profile

Dependency Diagram

graph TD
  3705e434_dfc7_b070_aae6_93314a9b9976["get_swagger_ui_html()"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24["docs.py"]
  3705e434_dfc7_b070_aae6_93314a9b9976 -->|defined in| 6383cfb2_5918_5c8c_5124_dbbbe44fbe24
  4b6b291c_66a3_2ac5_cd21_46f4058ea26f["custom_swagger_ui_html()"]
  4b6b291c_66a3_2ac5_cd21_46f4058ea26f -->|calls| 3705e434_dfc7_b070_aae6_93314a9b9976
  783e01b5_6c9a_8e11_a376_71ff444de26a["custom_swagger_ui_html()"]
  783e01b5_6c9a_8e11_a376_71ff444de26a -->|calls| 3705e434_dfc7_b070_aae6_93314a9b9976
  c029d7d0_68b4_7ce7_47cc_25c5b9dccd5d["setup()"]
  c029d7d0_68b4_7ce7_47cc_25c5b9dccd5d -->|calls| 3705e434_dfc7_b070_aae6_93314a9b9976
  d340379d_71d9_3564_53cd_32087c76ff09["test_strings_in_generated_swagger()"]
  d340379d_71d9_3564_53cd_32087c76ff09 -->|calls| 3705e434_dfc7_b070_aae6_93314a9b9976
  c0ea3c7e_d0d1_6024_0146_87da461cf4b1["test_strings_in_custom_swagger()"]
  c0ea3c7e_d0d1_6024_0146_87da461cf4b1 -->|calls| 3705e434_dfc7_b070_aae6_93314a9b9976
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder()"]
  3705e434_dfc7_b070_aae6_93314a9b9976 -->|calls| 1ac1bc37_1a47_e7e2_9156_ab0473094700
  style 3705e434_dfc7_b070_aae6_93314a9b9976 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/openapi/docs.py lines 26–180

def get_swagger_ui_html(
    *,
    openapi_url: Annotated[
        str,
        Doc(
            """
            The OpenAPI URL that Swagger UI should load and use.

            This is normally done automatically by FastAPI using the default URL
            `/openapi.json`.

            Read more about it in the
            [FastAPI docs for Conditional OpenAPI](https://fastapi.tiangolo.com/how-to/conditional-openapi/#conditional-openapi-from-settings-and-env-vars)
            """
        ),
    ],
    title: Annotated[
        str,
        Doc(
            """
            The HTML `<title>` content, normally shown in the browser tab.

            Read more about it in the
            [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
            """
        ),
    ],
    swagger_js_url: Annotated[
        str,
        Doc(
            """
            The URL to use to load the Swagger UI JavaScript.

            It is normally set to a CDN URL.

            Read more about it in the
            [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
            """
        ),
    ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js",
    swagger_css_url: Annotated[
        str,
        Doc(
            """
            The URL to use to load the Swagger UI CSS.

            It is normally set to a CDN URL.

            Read more about it in the
            [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
            """
        ),
    ] = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css",
    swagger_favicon_url: Annotated[
        str,
        Doc(
            """
            The URL of the favicon to use. It is normally shown in the browser tab.
            """
        ),
    ] = "https://fastapi.tiangolo.com/img/favicon.png",
    oauth2_redirect_url: Annotated[
        Optional[str],
        Doc(
            """
            The OAuth2 redirect URL, it is normally automatically handled by FastAPI.

            Read more about it in the
            [FastAPI docs for Custom Docs UI Static Assets](https://fastapi.tiangolo.com/how-to/custom-docs-ui-assets/)
            """
        ),
    ] = None,
    init_oauth: Annotated[
        Optional[dict[str, Any]],
        Doc(
            """
            A dictionary with Swagger UI OAuth2 initialization configurations.

            Read more about the available configuration options in the
            [Swagger UI docs](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/).
            """

Domain

Subdomains

Frequently Asked Questions

What does get_swagger_ui_html() do?
get_swagger_ui_html() is a function in the fastapi codebase, defined in fastapi/openapi/docs.py.
Where is get_swagger_ui_html() defined?
get_swagger_ui_html() is defined in fastapi/openapi/docs.py at line 26.
What does get_swagger_ui_html() call?
get_swagger_ui_html() calls 1 function(s): jsonable_encoder.
What calls get_swagger_ui_html()?
get_swagger_ui_html() is called by 5 function(s): custom_swagger_ui_html, custom_swagger_ui_html, setup, test_strings_in_custom_swagger, test_strings_in_generated_swagger.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free