From bb86eba0624072f4cb88de536f48fbec2dfc67a2 Mon Sep 17 00:00:00 2001 From: Carlos Mario Toro <41237977+cmtoro@users.noreply.github.com> Date: Tue, 13 May 2025 12:21:14 -0500 Subject: [PATCH] Add external_docs parameters to get_openapi method The OpenAPI class is being instantiated without the externalDocs parameter. --- fastapi/openapi/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fastapi/openapi/utils.py b/fastapi/openapi/utils.py index 808646cc2..b2913963e 100644 --- a/fastapi/openapi/utils.py +++ b/fastapi/openapi/utils.py @@ -489,6 +489,7 @@ def get_openapi( contact: Optional[Dict[str, Union[str, Any]]] = None, license_info: Optional[Dict[str, Union[str, Any]]] = None, separate_input_output_schemas: bool = True, + external_docs: Optional[Dict[str, Any]] = None, ) -> Dict[str, Any]: info: Dict[str, Any] = {"title": title, "version": version} if summary: @@ -566,4 +567,6 @@ def get_openapi( output["webhooks"] = webhook_paths if tags: output["tags"] = tags + if external_docs: + output["externalDocs"] = external_docs return jsonable_encoder(OpenAPI(**output), by_alias=True, exclude_none=True) # type: ignore