Home / File/ docs.py — fastapi Source File

docs.py — fastapi Source File

Architecture documentation for docs.py, a python file in the fastapi codebase. 6 imports, 4 dependents.

File python FastAPI Applications 6 imports 4 dependents 3 functions

Entity Profile

Dependency Diagram

graph LR
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24["docs.py"]
  c1ef60e8_e635_2e82_29e5_a79e03e975d6["json"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> c1ef60e8_e635_2e82_29e5_a79e03e975d6
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> 0dda2280_3359_8460_301c_e98c77e78185
  5efacb44_5373_ceb9_9579_6e6603820488["annotated_doc"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> 5efacb44_5373_ceb9_9579_6e6603820488
  ea747667_035c_8539_a8f7_f347fb7e7c39["encoders.py"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> ea747667_035c_8539_a8f7_f347fb7e7c39
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> 1ac1bc37_1a47_e7e2_9156_ab0473094700
  e5a24867_6a9b_cc44_1a92_bc955a4ceb50["starlette.responses"]
  6383cfb2_5918_5c8c_5124_dbbbe44fbe24 --> e5a24867_6a9b_cc44_1a92_bc955a4ceb50
  21963e59_2145_4b3f_7959_1cb20fa40113["tutorial001_py39.py"]
  21963e59_2145_4b3f_7959_1cb20fa40113 --> 6383cfb2_5918_5c8c_5124_dbbbe44fbe24
  fc26af4f_37d9_e0c9_cad9_51ee06effde8["tutorial002_py39.py"]
  fc26af4f_37d9_e0c9_cad9_51ee06effde8 --> 6383cfb2_5918_5c8c_5124_dbbbe44fbe24
  6c1867f2_34c4_b2ed_5639_41766e6fd7ce["applications.py"]
  6c1867f2_34c4_b2ed_5639_41766e6fd7ce --> 6383cfb2_5918_5c8c_5124_dbbbe44fbe24
  62047866_e337_3c14_2193_c01cbd5b91aa["test_local_docs.py"]
  62047866_e337_3c14_2193_c01cbd5b91aa --> 6383cfb2_5918_5c8c_5124_dbbbe44fbe24
  style 6383cfb2_5918_5c8c_5124_dbbbe44fbe24 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import json
from typing import Annotated, Any, Optional

from annotated_doc import Doc
from fastapi.encoders import jsonable_encoder
from starlette.responses import HTMLResponse

swagger_ui_default_parameters: Annotated[
    dict[str, Any],
    Doc(
        """
        Default configurations for Swagger UI.

        You can use it as a template to add any other configurations needed.
        """
    ),
] = {
    "dom_id": "#swagger-ui",
    "layout": "BaseLayout",
    "deepLinking": True,
    "showExtensions": True,
    "showCommonExtensions": True,
}


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.

// ... (316 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does docs.py do?
docs.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in docs.py?
docs.py defines 3 function(s): get_redoc_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html.
What does docs.py depend on?
docs.py imports 6 module(s): annotated_doc, encoders.py, json, jsonable_encoder, starlette.responses, typing.
What files import docs.py?
docs.py is imported by 4 file(s): applications.py, test_local_docs.py, tutorial001_py39.py, tutorial002_py39.py.
Where is docs.py in the architecture?
docs.py is located at fastapi/openapi/docs.py (domain: FastAPI, subdomain: Applications, directory: fastapi/openapi).

Analyze Your Own Codebase

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

Try Supermodel Free