← eval_submission

fastapi_13713

failed CONTEXT NO_PATCH UNSUBMITTED agent_error · 27 tool calls · 141 s · fastapi/fastapi

Task input

✨ Add OpenAPI `external_docs` parameter to `FastAPI`

This PR adds an external_docs parameter to the __init__ method of the FastAPI class. Currently, the external_docs parameter is not being passed when generating the OpenAPI documentation, which I believe is an oversight. By including this parameter in the FastAPI class constructor, the external_docs field will be correctly included in the root of the generated OpenAPI JSON or YAML file.

Reasoning:

The external_docs field provides valuable external documentation links and should be part of the OpenAPI metadata. Including it at the root level of the OpenAPI spec enhances the usability and completeness of the generated documentation, especially for providing references to external resources.

Tool calls (27)

#ToolArgumentsResult
1run_command
{
 "command": "grep -rn \"def __init__\" fastapi/applications.py"
}
{"status": "ok", "stdout": "64: def __init__(\n4568: def __init__(self, name: str):\n", "exit_code": 0}
full
{"status": "ok", "stdout": "64:    def __init__(\n4568:            def __init__(self, name: str):\n", "exit_code": 0}
2read_file
{
 "filepath": "fastapi/applications.py",
 "start_line": 64,
 "end_line": 120
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " def __init__(\n self: AppType,\n *,\n debug: Annotated[\n bool,\n Doc(\n \"\"\"\n Boolean i
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "    def __init__(\n        self: AppType,\n        *,\n        debug: Annotated[\n            bool,\n            Doc(\n                \"\"\"\n                Boolean indicating if debug tracebacks should be returned on server\n                errors.\n\n                Read more in the\n                [Starlette docs for Applications](https://www.starlette.io/applications/#instantiating-the-application).\n                \"\"\"\n            ),\n        ] = False,\n        routes: Annotated[\n            Optional[List[BaseRoute]],\n            Doc(\n                \"\"\"\n                **Note**: you probably shouldn't use this parameter, it is inherited\n                from Starlette and supported for compatibility.\n\n                ---\n\n                A list of routes to serve incoming HTTP and WebSocket requests.\n                \"\"\"\n            ),\n            deprecated(\n                \"\"\"\n                You normally wouldn't use this parameter with FastAPI, it is inherited\n                from Starlette and supported for compatibility.\n\n                In FastAPI, you normally would use the *path operation methods*,\n                like `app.get()`, `app.post()`, etc.\n                \"\"\"\n            ),\n        ] = None,\n        title: Annotated[\n            str,\n            Doc(\n                \"\"\"\n                The title of the API.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(title=\"ChimichangApp\")\n                ```\n                \"\"\"\n            ),\n", "start_line": 64, "end_line": 120, "total_lines": 45
3read_file
{
 "end_line": 160,
 "filepath": "fastapi/applications.py",
 "start_line": 121
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " ] = \"FastAPI\",\n summary: Annotated[\n Optional[str],\n Doc(\n \"\"\"\n A short summary o
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "        ] = \"FastAPI\",\n        summary: Annotated[\n            Optional[str],\n            Doc(\n                \"\"\"\n                A short summary of the API.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(summary=\"Deadpond's favorite app. Nuff said.\")\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        description: Annotated[\n            str,\n            Doc(\n                '''\n                A description of the API. Supports Markdown (using\n                [CommonMark syntax](https://commonmark.org/)).\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(\n", "start_line": 121, "end_line": 160, "total_lines": 4588, "is_truncated": false}
4read_file
{
 "end_line": 200,
 "filepath": "fastapi/applications.py",
 "start_line": 161
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " description=\"\"\"\n ChimichangApp API helps you do awesome stuff. \ud83d\ude80\n\n ## Item
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                    description=\"\"\"\n                                ChimichangApp API helps you do awesome stuff. \ud83d\ude80\n\n                                ## Items\n\n                                You can **read items**.\n\n                                ## Users\n\n                                You will be able to:\n\n                                * **Create users** (_not implemented_).\n                                * **Read users** (_not implemented_).\n\n                                \"\"\"\n                )\n                ```\n                '''\n            ),\n        ] = \"\",\n        version: Annotated[\n            str,\n            Doc(\n                \"\"\"\n                The version of the API.\n\n                **Note** This is the version of your application, not the version of\n                the OpenAPI specification nor the version of FastAPI being used.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(version=\"0.0.1\")\n", "start_line": 161, "end_line": 200, "total_lines": 4588, "is_truncated": false}
5read_file
{
 "end_line": 250,
 "filepath": "fastapi/applications.py",
 "start_line": 201
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " ```\n \"\"\"\n ),\n ] = \"0.1.0\",\n openapi_url: Annotated[\n Optional[str],\n Doc(\n \"\"
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                ```\n                \"\"\"\n            ),\n        ] = \"0.1.0\",\n        openapi_url: Annotated[\n            Optional[str],\n            Doc(\n                \"\"\"\n                The URL where the OpenAPI schema will be served from.\n\n                If you set it to `None`, no OpenAPI schema will be served publicly, and\n                the default automatic endpoints `/docs` and `/redoc` will also be\n                disabled.\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#openapi-url).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(openapi_url=\"/api/v1/openapi.json\")\n                ```\n                \"\"\"\n            ),\n        ] = \"/openapi.json\",\n        openapi_tags: Annotated[\n            Optional[List[Dict[str, Any]]],\n            Doc(\n                \"\"\"\n                A list of tags used by OpenAPI, these are the same `tags` you can set\n                in the *path operations*, like:\n\n                * `@app.get(\"/users/\", tags=[\"users\"])`\n                * `@app.get(\"/items/\", tags=[\"items\"])`\n\n                The order of the tags can be used to specify the order shown in\n                tools like Swagger UI, used in the automatic path `/docs`.\n\n                It's not required to specify all the tags used.\n\n                The tags that are not declared MAY be organized randomly or based\n                on the tools' logic. Each tag name in the list MUST be unique.\n\n                The value of each item is a `dict` containing:\n\n                * `name`: The name of the tag.\n                * `description`: A short description of the tag.\n                    [CommonMark syntax](https://commonmark.org/) MAY be used for rich\n", "s
6read_file
{
 "end_line": 300,
 "filepath": "fastapi/applications.py",
 "start_line": 251
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " text representation.\n * `externalDocs`: Additional external documentation for this tag. If
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                    text representation.\n                * `externalDocs`: Additional external documentation for this tag. If\n                    provided, it would contain a `dict` with:\n                    * `description`: A short description of the target documentation.\n                        [CommonMark syntax](https://commonmark.org/) MAY be used for\n                        rich text representation.\n                    * `url`: The URL for the target documentation. Value MUST be in\n                        the form of a URL.\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-tags).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                tags_metadata = [\n                    {\n                        \"name\": \"users\",\n                        \"description\": \"Operations with users. The **login** logic is also here.\",\n                    },\n                    {\n                        \"name\": \"items\",\n                        \"description\": \"Manage items. So _fancy_ they have their own docs.\",\n                        \"externalDocs\": {\n                            \"description\": \"Items external docs\",\n                            \"url\": \"https://fastapi.tiangolo.com/\",\n                        },\n                    },\n                ]\n\n                app = FastAPI(openapi_tags=tags_metadata)\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        servers: Annotated[\n            Optional[List[Dict[str, Union[str, Any]]]],\n            Doc(\n                \"\"\"\n                A `list` of `dict`s with connectivity information to a target server.\n\n                You would use it, for example, if your application is served from\n                di
7read_file
{
 "end_line": 350,
 "filepath": "fastapi/applications.py",
 "start_line": 301
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n Each item in the `list` is a `dict` containing:\n\n * `url`: A URL to the target host. Th
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n                Each item in the `list` is a `dict` containing:\n\n                * `url`: A URL to the target host. This URL supports Server Variables\n                and MAY be relative, to indicate that the host location is relative\n                to the location where the OpenAPI document is being served. Variable\n                substitutions will be made when a variable is named in `{`brackets`}`.\n                * `description`: An optional string describing the host designated by\n                the URL. [CommonMark syntax](https://commonmark.org/) MAY be used for\n                rich text representation.\n                * `variables`: A `dict` between a variable name and its value. The value\n                    is used for substitution in the server's URL template.\n\n                Read more in the\n                [FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#additional-servers).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(\n                    servers=[\n                        {\"url\": \"https://stag.example.com\", \"description\": \"Staging environment\"},\n                        {\"url\": \"https://prod.example.com\", \"description\": \"Production environment\"},\n                    ]\n                )\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        dependencies: Annotated[\n            Optional[Sequence[Depends]],\n            Doc(\n                \"\"\"\n                A list of global dependencies, they will be applied to each\n                *path operation*, including in sub-routers.\n\n                Read more about it in the\n                [FastAPI docs for Global Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/global-dependencies/).\n\n                **Example**\
8read_file
{
 "end_line": 400,
 "filepath": "fastapi/applications.py",
 "start_line": 351
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " \"\"\"\n ),\n ] = None,\n default_response_class: Annotated[\n Type[Response],\n Doc(\n \"\
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                \"\"\"\n            ),\n        ] = None,\n        default_response_class: Annotated[\n            Type[Response],\n            Doc(\n                \"\"\"\n                The default response class to be used.\n\n                Read more in the\n                [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n                from fastapi.responses import ORJSONResponse\n\n                app = FastAPI(default_response_class=ORJSONResponse)\n                ```\n                \"\"\"\n            ),\n        ] = Default(JSONResponse),\n        redirect_slashes: Annotated[\n            bool,\n            Doc(\n                \"\"\"\n                Whether to detect and redirect slashes in URLs when the client doesn't\n                use the same format.\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(redirect_slashes=True)  # the default\n\n                @app.get(\"/items/\")\n                async def read_items():\n                    return [{\"item_id\": \"Foo\"}]\n                ```\n\n                With this app, if a client goes to `/items` (without a trailing slash),\n                they will be automatically redirected with an HTTP status code of 307\n                to `/items/`.\n                \"\"\"\n            ),\n        ] = True,\n        docs_url: Annotated[\n            Optional[str],\n", "start_line": 351, "end_line": 400, "total_lines": 4588, "is_truncated": false}
9read_file
{
 "end_line": 450,
 "filepath": "fastapi/applications.py",
 "start_line": 401
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " Doc(\n \"\"\"\n The path to the automatic interactive API documentation.\n It is handled in
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "            Doc(\n                \"\"\"\n                The path to the automatic interactive API documentation.\n                It is handled in the browser by Swagger UI.\n\n                The default URL is `/docs`. You can disable it by setting it to `None`.\n\n                If `openapi_url` is set to `None`, this will be automatically disabled.\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(docs_url=\"/documentation\", redoc_url=None)\n                ```\n                \"\"\"\n            ),\n        ] = \"/docs\",\n        redoc_url: Annotated[\n            Optional[str],\n            Doc(\n                \"\"\"\n                The path to the alternative automatic interactive API documentation\n                provided by ReDoc.\n\n                The default URL is `/redoc`. You can disable it by setting it to `None`.\n\n                If `openapi_url` is set to `None`, this will be automatically disabled.\n\n                Read more in the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#docs-urls).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(docs_url=\"/documentation\", redoc_url=\"redocumentation\")\n                ```\n                \"\"\"\n            ),\n        ] = \"/redoc\",\n        swagger_ui_oauth2_redirect_url: Annotated[\n            Optional[str],\n            Doc(\n                \"\"\"\n", "start_line": 401, "end_line": 450, "total_lines": 4588, "is_truncated": false}
10read_file
{
 "end_line": 500,
 "filepath": "fastapi/applications.py",
 "start_line": 451
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " The OAuth2 redirect endpoint for the Swagger UI.\n\n By default it is `/docs/oauth2-redirec
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                The OAuth2 redirect endpoint for the Swagger UI.\n\n                By default it is `/docs/oauth2-redirect`.\n\n                This is only used if you use OAuth2 (with the \"Authorize\" button)\n                with Swagger UI.\n                \"\"\"\n            ),\n        ] = \"/docs/oauth2-redirect\",\n        swagger_ui_init_oauth: Annotated[\n            Optional[Dict[str, Any]],\n            Doc(\n                \"\"\"\n                OAuth2 configuration for the Swagger UI, by default shown at `/docs`.\n\n                Read more about the available configuration options in the\n                [Swagger UI docs](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/).\n                \"\"\"\n            ),\n        ] = None,\n        middleware: Annotated[\n            Optional[Sequence[Middleware]],\n            Doc(\n                \"\"\"\n                List of middleware to be added when creating the application.\n\n                In FastAPI you would normally do this with `app.add_middleware()`\n                instead.\n\n                Read more in the\n                [FastAPI docs for Middleware](https://fastapi.tiangolo.com/tutorial/middleware/).\n                \"\"\"\n            ),\n        ] = None,\n        exception_handlers: Annotated[\n            Optional[\n                Dict[\n                    Union[int, Type[Exception]],\n                    Callable[[Request, Any], Coroutine[Any, Any, Response]],\n                ]\n            ],\n            Doc(\n                \"\"\"\n                A dictionary with handlers for exceptions.\n\n                In FastAPI, you would normally use the decorator\n                `@app.exception_handler()`.\n\n                Read more in the\n                [FastAPI docs for Handling Errors](https://fastapi.tiangolo.com/tutorial/handling-errors/).\n", "start_line": 451, "end_line": 500, "
11read_file
{
 "end_line": 550,
 "filepath": "fastapi/applications.py",
 "start_line": 501
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " \"\"\"\n ),\n ] = None,\n on_startup: Annotated[\n Optional[Sequence[Callable[[], Any]]],\n
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                \"\"\"\n            ),\n        ] = None,\n        on_startup: Annotated[\n            Optional[Sequence[Callable[[], Any]]],\n            Doc(\n                \"\"\"\n                A list of startup event handler functions.\n\n                You should instead use the `lifespan` handlers.\n\n                Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).\n                \"\"\"\n            ),\n        ] = None,\n        on_shutdown: Annotated[\n            Optional[Sequence[Callable[[], Any]]],\n            Doc(\n                \"\"\"\n                A list of shutdown event handler functions.\n\n                You should instead use the `lifespan` handlers.\n\n                Read more in the\n                [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).\n                \"\"\"\n            ),\n        ] = None,\n        lifespan: Annotated[\n            Optional[Lifespan[AppType]],\n            Doc(\n                \"\"\"\n                A `Lifespan` context manager handler. This replaces `startup` and\n                `shutdown` functions with a single context manager.\n\n                Read more in the\n                [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).\n                \"\"\"\n            ),\n        ] = None,\n        terms_of_service: Annotated[\n            Optional[str],\n            Doc(\n                \"\"\"\n                A URL to the Terms of Service for your API.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more at the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n", "start_line": 501, "end_line": 550, "total_lines": 4588, "is_truncated": false}
12read_file
{
 "end_line": 600,
 "filepath": "fastapi/applications.py",
 "start_line": 551
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n **Example**\n\n ```python\n app = FastAPI(terms_of_service=\"http://example.com/terms/\")
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n                **Example**\n\n                ```python\n                app = FastAPI(terms_of_service=\"http://example.com/terms/\")\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        contact: Annotated[\n            Optional[Dict[str, Union[str, Any]]],\n            Doc(\n                \"\"\"\n                A dictionary with the contact information for the exposed API.\n\n                It can contain several fields.\n\n                * `name`: (`str`) The name of the contact person/organization.\n                * `url`: (`str`) A URL pointing to the contact information. MUST be in\n                    the format of a URL.\n                * `email`: (`str`) The email address of the contact person/organization.\n                    MUST be in the format of an email address.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more at the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                app = FastAPI(\n                    contact={\n                        \"name\": \"Deadpoolio the Amazing\",\n                        \"url\": \"http://x-force.example.com/contact/\",\n                        \"email\": \"dp@x-force.example.com\",\n                    }\n                )\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        license_info: Annotated[\n            Optional[Dict[str, Union[str, Any]]],\n            Doc(\n                \"\"\"\n                A dictionary with the license information for the exposed API.\n\n                It can contain several fields.\n\n", "start_line": 551, "end_line": 600, "total_lines": 4588, "is_truncated": false}
13read_file
{
 "end_line": 650,
 "filepath": "fastapi/applications.py",
 "start_line": 601
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " * `name`: (`str`) **REQUIRED** (if a `license_info` is set). The\n license name used for th
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                * `name`: (`str`) **REQUIRED** (if a `license_info` is set). The\n                    license name used for the API.\n                * `identifier`: (`str`) An [SPDX](https://spdx.dev/) license expression\n                    for the API. The `identifier` field is mutually exclusive of the `url`\n                    field. Available since OpenAPI 3.1.0, FastAPI 0.99.0.\n                * `url`: (`str`) A URL to the license used for the API. This MUST be\n                    the format of a URL.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more at the\n                [FastAPI docs for Metadata and Docs URLs](https://fastapi.tiangolo.com/tutorial/metadata/#metadata-for-api).\n\n                **Example**\n\n                ```python\n                app = FastAPI(\n                    license_info={\n                        \"name\": \"Apache 2.0\",\n                        \"url\": \"https://www.apache.org/licenses/LICENSE-2.0.html\",\n                    }\n                )\n                ```\n                \"\"\"\n            ),\n        ] = None,\n        openapi_prefix: Annotated[\n            str,\n            Doc(\n                \"\"\"\n                A URL prefix for the OpenAPI URL.\n                \"\"\"\n            ),\n            deprecated(\n                \"\"\"\n                \"openapi_prefix\" has been deprecated in favor of \"root_path\", which\n                follows more closely the ASGI standard, is simpler, and more\n                automatic.\n                \"\"\"\n            ),\n        ] = \"\",\n        root_path: Annotated[\n            str,\n            Doc(\n                \"\"\"\n                A path prefix handled by a proxy that is not seen by the application\n                but is seen by external clients, which affects things like Swagger UI.\n\n                Re
14read_file
{
 "end_line": 700,
 "filepath": "fastapi/applications.py",
 "start_line": 651
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n **Example**\n\n ```python\n from fastapi import FastAPI\n\n app = FastAPI(root_path=\"/ap
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(root_path=\"/api/v1\")\n                ```\n                \"\"\"\n            ),\n        ] = \"\",\n        root_path_in_servers: Annotated[\n            bool,\n            Doc(\n                \"\"\"\n                To disable automatically generating the URLs in the `servers` field\n                in the autogenerated OpenAPI using the `root_path`.\n\n                Read more about it in the\n                [FastAPI docs for Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/#disable-automatic-server-from-root_path).\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI(root_path_in_servers=False)\n                ```\n                \"\"\"\n            ),\n        ] = True,\n        responses: Annotated[\n            Optional[Dict[Union[int, str], Dict[str, Any]]],\n            Doc(\n                \"\"\"\n                Additional responses to be shown in OpenAPI.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more about it in the\n                [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/).\n\n                And in the\n                [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies).\n                \"\"\"\n            ),\n        ] = None,\n        callbacks: Annotated[\n            Optional[List[BaseRoute]],\n            Doc(\n", "start_line": 651, "end_line": 700, "total_lines": 4588, "is_truncated": false}
15read_file
{
 "end_line": 750,
 "filepath": "fastapi/applications.py",
 "start_line": 701
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " \"\"\"\n OpenAPI callbacks that should apply to all *path operations*.\n\n It will be added
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                \"\"\"\n                OpenAPI callbacks that should apply to all *path operations*.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more about it in the\n                [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).\n                \"\"\"\n            ),\n        ] = None,\n        webhooks: Annotated[\n            Optional[routing.APIRouter],\n            Doc(\n                \"\"\"\n                Add OpenAPI webhooks. This is similar to `callbacks` but it doesn't\n                depend on specific *path operations*.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                **Note**: This is available since OpenAPI 3.1.0, FastAPI 0.99.0.\n\n                Read more about it in the\n                [FastAPI docs for OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/).\n                \"\"\"\n            ),\n        ] = None,\n        deprecated: Annotated[\n            Optional[bool],\n            Doc(\n                \"\"\"\n                Mark all *path operations* as deprecated. You probably don't need it,\n                but it's available.\n\n                It will be added to the generated OpenAPI (e.g. visible at `/docs`).\n\n                Read more about it in the\n                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).\n                \"\"\"\n            ),\n        ] = None,\n        include_in_schema: Annotated[\n            bool,\n            Doc(\n                \"\"\"\n                To include (or not) all the *path operations* in the generated OpenAPI.\n                You probably don't need it, but it's available.\n\n                This affects the generated OpenAPI (e.g. visible at `/doc
16read_file
{
 "end_line": 800,
 "filepath": "fastapi/applications.py",
 "start_line": 751
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tut
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi).\n                \"\"\"\n            ),\n        ] = True,\n        swagger_ui_parameters: Annotated[\n            Optional[Dict[str, Any]],\n            Doc(\n                \"\"\"\n                Parameters to configure Swagger UI, the autogenerated interactive API\n                documentation (by default at `/docs`).\n\n                Read more about it in the\n                [FastAPI docs about how to Configure Swagger UI](https://fastapi.tiangolo.com/how-to/configure-swagger-ui/).\n                \"\"\"\n            ),\n        ] = None,\n        generate_unique_id_function: Annotated[\n            Callable[[routing.APIRoute], str],\n            Doc(\n                \"\"\"\n                Customize the function used to generate unique IDs for the *path\n                operations* shown in the generated OpenAPI.\n\n                This is particularly useful when automatically generating clients or\n                SDKs for your API.\n\n                Read more about it in the\n                [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).\n                \"\"\"\n            ),\n        ] = Default(generate_unique_id),\n        separate_input_output_schemas: Annotated[\n            bool,\n            Doc(\n                \"\"\"\n                Whether to generate separate OpenAPI schemas for request body and\n                response body when the results would be more precise.\n\n                This is particularly useful when automatically generating clients.\n\n                For example, if you have a model like:\n\n                ```python\n                from pydantic import BaseModel\n\n                class
17read_file
{
 "end_line": 850,
 "filepath": "fastapi/applications.py",
 "start_line": 801
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " When `Item` is used for input, a request body, `tags` is not required,\n the client doesn't
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "                When `Item` is used for input, a request body, `tags` is not required,\n                the client doesn't have to provide it.\n\n                But when using `Item` for output, for a response body, `tags` is always\n                available because it has a default value, even if it's just an empty\n                list. So, the client should be able to always expect it.\n\n                In this case, there would be two different schemas, one for input and\n                another one for output.\n                \"\"\"\n            ),\n        ] = True,\n        **extra: Annotated[\n            Any,\n            Doc(\n                \"\"\"\n                Extra keyword arguments to be stored in the app, not used by FastAPI\n                anywhere.\n                \"\"\"\n            ),\n        ],\n    ) -> None:\n        self.debug = debug\n        self.title = title\n        self.summary = summary\n        self.description = description\n        self.version = version\n        self.terms_of_service = terms_of_service\n        self.contact = contact\n        self.license_info = license_info\n        self.openapi_url = openapi_url\n        self.openapi_tags = openapi_tags\n        self.root_path_in_servers = root_path_in_servers\n        self.docs_url = docs_url\n        self.redoc_url = redoc_url\n        self.swagger_ui_oauth2_redirect_url = swagger_ui_oauth2_redirect_url\n        self.swagger_ui_init_oauth = swagger_ui_init_oauth\n        self.swagger_ui_parameters = swagger_ui_parameters\n        self.servers = servers or []\n        self.separate_input_output_schemas = separate_input_output_schemas\n        self.extra = extra\n        self.openapi_version: Annotated[\n            str,\n            Doc(\n                \"\"\"\n                The version string of OpenAPI.\n\n                FastAPI will generate OpenAPI version 3.1.0, and will output that as\n      
18read_file
{
 "end_line": 870,
 "filepath": "fastapi/applications.py",
 "start_line": 851
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n So you could override this value to trick those tools into using\n the generated OpenAPI.
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "\n                So you could override this value to trick those tools into using\n                the generated OpenAPI. Have in mind that this is a hack. But if you\n                avoid using features added in OpenAPI 3.1.0, it might work for your\n                use case.\n\n                This is not passed as a parameter to the `FastAPI` class to avoid\n                giving the false idea that FastAPI would generate a different OpenAPI\n                schema. It is only available as an attribute.\n\n                **Example**\n\n                ```python\n                from fastapi import FastAPI\n\n                app = FastAPI()\n\n                app.openapi_version = \"3.0.2\"\n                ```\n                \"\"\"\n", "start_line": 851, "end_line": 870, "total_lines": 4588, "is_truncated": false}
19read_file
{
 "end_line": 1000,
 "filepath": "fastapi/applications.py",
 "start_line": 871
}
{"status": "ok", "filepath": "fastapi/applications.py", "content": " ),\n ] = \"3.1.0\"\n self.openapi_schema: Optional[Dict[str, Any]] = None\n if self.openapi
full
{"status": "ok", "filepath": "fastapi/applications.py", "content": "            ),\n        ] = \"3.1.0\"\n        self.openapi_schema: Optional[Dict[str, Any]] = None\n        if self.openapi_url:\n            assert self.title, \"A title must be provided for OpenAPI, e.g.: 'My API'\"\n            assert self.version, \"A version must be provided for OpenAPI, e.g.: '2.1.0'\"\n        # TODO: remove when discarding the openapi_prefix parameter\n        if openapi_prefix:\n            logger.warning(\n                '\"openapi_prefix\" has been deprecated in favor of \"root_path\", which '\n                \"follows more closely the ASGI standard, is simpler, and more \"\n                \"automatic. Check the docs at \"\n                \"https://fastapi.tiangolo.com/advanced/sub-applications/\"\n            )\n        self.webhooks: Annotated[\n            routing.APIRouter,\n            Doc(\n                \"\"\"\n                The `app.webhooks` attribute is an `APIRouter` with the *path\n                operations* that will be used just for documentation of webhooks.\n\n                Read more about it in the\n                [FastAPI docs for OpenAPI Webhooks](https://fastapi.tiangolo.com/advanced/openapi-webhooks/).\n                \"\"\"\n            ),\n        ] = webhooks or routing.APIRouter()\n        self.root_path = root_path or openapi_prefix\n        self.state: Annotated[\n            State,\n            Doc(\n                \"\"\"\n                A state object for the application. This is the same object for the\n                entire application, it doesn't change from request to request.\n\n                You normally wouldn't use this in FastAPI, for most of the cases you\n                would instead use FastAPI dependencies.\n\n                This is simply inherited from Starlette.\n\n                Read more about it in the\n                [Starlette docs for Applications](https://www.starlette.io/applications/#storing-stat
20read_file
{
 "end_line": 150,
 "filepath": "fastapi/openapi/utils.py",
 "start_line": 1
}
{"status": "ok", "filepath": "fastapi/openapi/utils.py", "content": "import http.client\nimport inspect\nimport warnings\nfrom typing import Any, Dict, List, Op
full
{"status": "ok", "filepath": "fastapi/openapi/utils.py", "content": "import http.client\nimport inspect\nimport warnings\nfrom typing import Any, Dict, List, Optional, Sequence, Set, Tuple, Type, Union, cast\n\nfrom fastapi import routing\nfrom fastapi._compat import (\n    GenerateJsonSchema,\n    JsonSchemaValue,\n    ModelField,\n    Undefined,\n    get_compat_model_name_map,\n    get_definitions,\n    get_schema_from_model_field,\n    lenient_issubclass,\n)\nfrom fastapi.datastructures import DefaultPlaceholder\nfrom fastapi.dependencies.models import Dependant\nfrom fastapi.dependencies.utils import (\n    _get_flat_fields_from_params,\n    get_flat_dependant,\n    get_flat_params,\n)\nfrom fastapi.encoders import jsonable_encoder\nfrom fastapi.openapi.constants import METHODS_WITH_BODY, REF_PREFIX, REF_TEMPLATE\nfrom fastapi.openapi.models import OpenAPI\nfrom fastapi.params import Body, ParamTypes\nfrom fastapi.responses import Response\nfrom fastapi.types import ModelNameMap\nfrom fastapi.utils import (\n    deep_dict_update,\n    generate_operation_id_for_path,\n    is_body_allowed_for_status_code,\n)\nfrom pydantic import BaseModel\nfrom starlette.responses import JSONResponse\nfrom starlette.routing import BaseRoute\nfrom typing_extensions import Literal\n\nvalidation_error_definition = {\n    \"title\": \"ValidationError\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"loc\": {\n            \"title\": \"Location\",\n            \"type\": \"array\",\n            \"items\": {\"anyOf\": [{\"type\": \"string\"}, {\"type\": \"integer\"}]},\n        },\n        \"msg\": {\"title\": \"Message\", \"type\": \"string\"},\n        \"type\": {\"title\": \"Error Type\", \"type\": \"string\"},\n    },\n    \"required\": [\"loc\", \"msg\", \"type\"],\n}\n\nvalidation_error_response_definition = {\n    \"title\": \"HTTPValidationError\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"detail\": {\n            \"title\": \"Detail\",\n         
21run_command
{
 "command": "grep -rn \"def get_openapi\" fastapi/openapi/utils.py"
}
{"status": "ok", "stdout": "77:def get_openapi_security_definitions(\n169:def get_openapi_operation_request_body(\n227:def get_openapi_operation_metadata(\n253:
full
{"status": "ok", "stdout": "77:def get_openapi_security_definitions(\n169:def get_openapi_operation_request_body(\n227:def get_openapi_operation_metadata(\n253:def get_openapi_path(\n476:def get_openapi(\n", "exit_code": 0}
22read_file
{
 "end_line": 568,
 "filepath": "fastapi/openapi/utils.py",
 "start_line": 476
}
{"status": "ok", "filepath": "fastapi/openapi/utils.py", "content": "def get_openapi(\n *,\n title: str,\n version: str,\n openapi_version: str = \"3.1.0\",\n s
full
{"status": "ok", "filepath": "fastapi/openapi/utils.py", "content": "def get_openapi(\n    *,\n    title: str,\n    version: str,\n    openapi_version: str = \"3.1.0\",\n    summary: Optional[str] = None,\n    description: Optional[str] = None,\n    routes: Sequence[BaseRoute],\n    webhooks: Optional[Sequence[BaseRoute]] = None,\n    tags: Optional[List[Dict[str, Any]]] = None,\n    servers: Optional[List[Dict[str, Union[str, Any]]]] = None,\n    terms_of_service: Optional[str] = None,\n    contact: Optional[Dict[str, Union[str, Any]]] = None,\n    license_info: Optional[Dict[str, Union[str, Any]]] = None,\n    separate_input_output_schemas: bool = True,\n) -> Dict[str, Any]:\n    info: Dict[str, Any] = {\"title\": title, \"version\": version}\n    if summary:\n        info[\"summary\"] = summary\n    if description:\n        info[\"description\"] = description\n    if terms_of_service:\n        info[\"termsOfService\"] = terms_of_service\n    if contact:\n        info[\"contact\"] = contact\n    if license_info:\n        info[\"license\"] = license_info\n    output: Dict[str, Any] = {\"openapi\": openapi_version, \"info\": info}\n    if servers:\n        output[\"servers\"] = servers\n    components: Dict[str, Dict[str, Any]] = {}\n    paths: Dict[str, Dict[str, Any]] = {}\n    webhook_paths: Dict[str, Dict[str, Any]] = {}\n    operation_ids: Set[str] = set()\n    all_fields = get_fields_from_routes(list(routes or []) + list(webhooks or []))\n    model_name_map = get_compat_model_name_map(all_fields)\n    schema_generator = GenerateJsonSchema(ref_template=REF_TEMPLATE)\n    field_mapping, definitions = get_definitions(\n        fields=all_fields,\n        schema_generator=schema_generator,\n        model_name_map=model_name_map,\n        separate_input_output_schemas=separate_input_output_schemas,\n    )\n    for route in routes or []:\n        if isinstance(route, routing.APIRoute):\n            result = get_openapi_path(\n                route=route,\n          
23read_file
{
 "end_line": 100,
 "filepath": "fastapi/openapi/models.py",
 "start_line": 1
}
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "from enum import Enum\nfrom typing import Any, Callable, Dict, Iterable, List, Optional, S
full
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "from enum import Enum\nfrom typing import Any, Callable, Dict, Iterable, List, Optional, Set, Type, Union\n\nfrom fastapi._compat import (\n    PYDANTIC_V2,\n    CoreSchema,\n    GetJsonSchemaHandler,\n    JsonSchemaValue,\n    _model_rebuild,\n    with_info_plain_validator_function,\n)\nfrom fastapi.logger import logger\nfrom pydantic import AnyUrl, BaseModel, Field\nfrom typing_extensions import Annotated, Literal, TypedDict\nfrom typing_extensions import deprecated as typing_deprecated\n\ntry:\n    import email_validator\n\n    assert email_validator  # make autoflake ignore the unused import\n    from pydantic import EmailStr\nexcept ImportError:  # pragma: no cover\n\n    class EmailStr(str):  # type: ignore\n        @classmethod\n        def __get_validators__(cls) -> Iterable[Callable[..., Any]]:\n            yield cls.validate\n\n        @classmethod\n        def validate(cls, v: Any) -> str:\n            logger.warning(\n                \"email-validator not installed, email fields will be treated as str.\\n\"\n                \"To install, run: pip install email-validator\"\n            )\n            return str(v)\n\n        @classmethod\n        def _validate(cls, __input_value: Any, _: Any) -> str:\n            logger.warning(\n                \"email-validator not installed, email fields will be treated as str.\\n\"\n                \"To install, run: pip install email-validator\"\n            )\n            return str(__input_value)\n\n        @classmethod\n        def __get_pydantic_json_schema__(\n            cls, core_schema: CoreSchema, handler: GetJsonSchemaHandler\n        ) -> JsonSchemaValue:\n            return {\"type\": \"string\", \"format\": \"email\"}\n\n        @classmethod\n        def __get_pydantic_core_schema__(\n            cls, source: Type[Any], handler: Callable[[Any], CoreSchema]\n        ) -> CoreSchema:\n            return with_info_plain_validator_function
24read_file
{
 "end_line": 150,
 "filepath": "fastapi/openapi/models.py",
 "start_line": 101
}
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "\nclass Reference(BaseModel):\n ref: str = Field(alias=\"$ref\")\n\n\nclass Discriminator(
full
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "\nclass Reference(BaseModel):\n    ref: str = Field(alias=\"$ref\")\n\n\nclass Discriminator(BaseModel):\n    propertyName: str\n    mapping: Optional[Dict[str, str]] = None\n\n\nclass XML(BaseModelWithConfig):\n    name: Optional[str] = None\n    namespace: Optional[str] = None\n    prefix: Optional[str] = None\n    attribute: Optional[bool] = None\n    wrapped: Optional[bool] = None\n\n\nclass ExternalDocumentation(BaseModelWithConfig):\n    description: Optional[str] = None\n    url: AnyUrl\n\n\nclass Schema(BaseModelWithConfig):\n    # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-the-json-schema-core-vocabu\n    # Core Vocabulary\n    schema_: Optional[str] = Field(default=None, alias=\"$schema\")\n    vocabulary: Optional[str] = Field(default=None, alias=\"$vocabulary\")\n    id: Optional[str] = Field(default=None, alias=\"$id\")\n    anchor: Optional[str] = Field(default=None, alias=\"$anchor\")\n    dynamicAnchor: Optional[str] = Field(default=None, alias=\"$dynamicAnchor\")\n    ref: Optional[str] = Field(default=None, alias=\"$ref\")\n    dynamicRef: Optional[str] = Field(default=None, alias=\"$dynamicRef\")\n    defs: Optional[Dict[str, \"SchemaOrBool\"]] = Field(default=None, alias=\"$defs\")\n    comment: Optional[str] = Field(default=None, alias=\"$comment\")\n    # Ref: JSON Schema 2020-12: https://json-schema.org/draft/2020-12/json-schema-core.html#name-a-vocabulary-for-applying-s\n    # A Vocabulary for Applying Subschemas\n    allOf: Optional[List[\"SchemaOrBool\"]] = None\n    anyOf: Optional[List[\"SchemaOrBool\"]] = None\n    oneOf: Optional[List[\"SchemaOrBool\"]] = None\n    not_: Optional[\"SchemaOrBool\"] = Field(default=None, alias=\"not\")\n    if_: Optional[\"SchemaOrBool\"] = Field(default=None, alias=\"if\")\n    then: Optional[\"SchemaOrBool\"] = None\n    else_: Optional[\"SchemaOrBool\"] = Field(default=None, alias=\"els
25read_file
{
 "end_line": 200,
 "filepath": "fastapi/openapi/models.py",
 "start_line": 151
}
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": " contains: Optional[\"SchemaOrBool\"] = None\n properties: Optional[Dict[str, \"SchemaOrBo
full
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "    contains: Optional[\"SchemaOrBool\"] = None\n    properties: Optional[Dict[str, \"SchemaOrBool\"]] = None\n    patternProperties: Optional[Dict[str, \"SchemaOrBool\"]] = None\n    additionalProperties: Optional[\"SchemaOrBool\"] = None\n    propertyNames: Optional[\"SchemaOrBool\"] = None\n    unevaluatedItems: Optional[\"SchemaOrBool\"] = None\n    unevaluatedProperties: Optional[\"SchemaOrBool\"] = None\n    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-structural\n    # A Vocabulary for Structural Validation\n    type: Optional[str] = None\n    enum: Optional[List[Any]] = None\n    const: Optional[Any] = None\n    multipleOf: Optional[float] = Field(default=None, gt=0)\n    maximum: Optional[float] = None\n    exclusiveMaximum: Optional[float] = None\n    minimum: Optional[float] = None\n    exclusiveMinimum: Optional[float] = None\n    maxLength: Optional[int] = Field(default=None, ge=0)\n    minLength: Optional[int] = Field(default=None, ge=0)\n    pattern: Optional[str] = None\n    maxItems: Optional[int] = Field(default=None, ge=0)\n    minItems: Optional[int] = Field(default=None, ge=0)\n    uniqueItems: Optional[bool] = None\n    maxContains: Optional[int] = Field(default=None, ge=0)\n    minContains: Optional[int] = Field(default=None, ge=0)\n    maxProperties: Optional[int] = Field(default=None, ge=0)\n    minProperties: Optional[int] = Field(default=None, ge=0)\n    required: Optional[List[str]] = None\n    dependentRequired: Optional[Dict[str, Set[str]]] = None\n    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-vocabularies-for-semantic-c\n    # Vocabularies for Semantic Content With \"format\"\n    format: Optional[str] = None\n    # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#na
26read_file
{
 "end_line": 445,
 "filepath": "fastapi/openapi/models.py",
 "start_line": 201
}
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": " externalDocs: Optional[ExternalDocumentation] = None\n example: Annotated[\n Optional[Any
full
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "    externalDocs: Optional[ExternalDocumentation] = None\n    example: Annotated[\n        Optional[Any],\n        typing_deprecated(\n            \"Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, \"\n            \"although still supported. Use examples instead.\"\n        ),\n    ] = None\n\n\n# Ref: https://json-schema.org/draft/2020-12/json-schema-core.html#name-json-schema-documents\n# A JSON Schema MUST be an object or a boolean.\nSchemaOrBool = Union[Schema, bool]\n\n\nclass Example(TypedDict, total=False):\n    summary: Optional[str]\n    description: Optional[str]\n    value: Optional[Any]\n    externalValue: Optional[AnyUrl]\n\n    if PYDANTIC_V2:  # type: ignore [misc]\n        __pydantic_config__ = {\"extra\": \"allow\"}\n\n    else:\n\n        class Config:\n            extra = \"allow\"\n\n\nclass ParameterInType(Enum):\n    query = \"query\"\n    header = \"header\"\n    path = \"path\"\n    cookie = \"cookie\"\n\n\nclass Encoding(BaseModelWithConfig):\n    contentType: Optional[str] = None\n    headers: Optional[Dict[str, Union[\"Header\", Reference]]] = None\n    style: Optional[str] = None\n    explode: Optional[bool] = None\n    allowReserved: Optional[bool] = None\n\n\nclass MediaType(BaseModelWithConfig):\n    schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias=\"schema\")\n    example: Optional[Any] = None\n    examples: Optional[Dict[str, Union[Example, Reference]]] = None\n    encoding: Optional[Dict[str, Encoding]] = None\n\n\nclass ParameterBase(BaseModelWithConfig):\n    description: Optional[str] = None\n    required: Optional[bool] = None\n    deprecated: Optional[bool] = None\n    # Serialization rules for simple scenarios\n    style: Optional[str] = None\n    explode: Optional[bool] = None\n    allowReserved: Optional[bool] = None\n    schema_: Optional[Union[Schema, Reference]] = Field(default=None, alias=\"schema\")\n    example: O
27read_file
{
 "end_line": 445,
 "filepath": "fastapi/openapi/models.py",
 "start_line": 351
}
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": " in_: APIKeyIn = Field(alias=\"in\")\n name: str\n\n\nclass HTTPBase(SecurityBase):\n type
full
{"status": "ok", "filepath": "fastapi/openapi/models.py", "content": "    in_: APIKeyIn = Field(alias=\"in\")\n    name: str\n\n\nclass HTTPBase(SecurityBase):\n    type_: SecuritySchemeType = Field(default=SecuritySchemeType.http, alias=\"type\")\n    scheme: str\n\n\nclass HTTPBearer(HTTPBase):\n    scheme: Literal[\"bearer\"] = \"bearer\"\n    bearerFormat: Optional[str] = None\n\n\nclass OAuthFlow(BaseModelWithConfig):\n    refreshUrl: Optional[str] = None\n    scopes: Dict[str, str] = {}\n\n\nclass OAuthFlowImplicit(OAuthFlow):\n    authorizationUrl: str\n\n\nclass OAuthFlowPassword(OAuthFlow):\n    tokenUrl: str\n\n\nclass OAuthFlowClientCredentials(OAuthFlow):\n    tokenUrl: str\n\n\nclass OAuthFlowAuthorizationCode(OAuthFlow):\n    authorizationUrl: str\n    tokenUrl: str\n\n\nclass OAuthFlows(BaseModelWithConfig):\n    implicit: Optional[OAuthFlowImplicit] = None\n    password: Optional[OAuthFlowPassword] = None\n    clientCredentials: Optional[OAuthFlowClientCredentials] = None\n    authorizationCode: Optional[OAuthFlowAuthorizationCode] = None\n\n\nclass OAuth2(SecurityBase):\n    type_: SecuritySchemeType = Field(default=SecuritySchemeType.oauth2, alias=\"type\")\n    flows: OAuthFlows\n\n\nclass OpenIdConnect(SecurityBase):\n    type_: SecuritySchemeType = Field(\n        default=SecuritySchemeType.openIdConnect, alias=\"type\"\n    )\n    openIdConnectUrl: str\n\n\nSecurityScheme = Union[APIKey, HTTPBase, OAuth2, OpenIdConnect, HTTPBearer]\n\n\nclass Components(BaseModelWithConfig):\n    schemas: Optional[Dict[str, Union[Schema, Reference]]] = None\n    responses: Optional[Dict[str, Union[Response, Reference]]] = None\n    parameters: Optional[Dict[str, Union[Parameter, Reference]]] = None\n    examples: Optional[Dict[str, Union[Example, Reference]]] = None\n    requestBodies: Optional[Dict[str, Union[RequestBody, Reference]]] = None\n    headers: Optional[Dict[str, Union[Header, Reference]]] = None\n    securitySchemes: Optional[Dict[str, Union[Securi