From d7869a4d1eecbc3159dfaba046968e79632d8b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=9E=E6=B3=95=E6=93=8D=E4=BD=9C?= Date: Tue, 26 Aug 2025 11:41:00 +0800 Subject: [PATCH] feat: add authorizations for swagger doc (#24518) --- api/libs/external_api.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/libs/external_api.py b/api/libs/external_api.py index 95d13cd0e6..d5e3c76d20 100644 --- a/api/libs/external_api.py +++ b/api/libs/external_api.py @@ -106,6 +106,17 @@ def register_external_error_handlers(api: Api) -> None: class ExternalApi(Api): + _authorizations = { + "Bearer": { + "type": "apiKey", + "in": "header", + "name": "Authorization", + "description": "Type: Bearer {your-api-key}", + } + } + def __init__(self, *args, **kwargs): + kwargs.setdefault("authorizations", self._authorizations) + kwargs.setdefault("security", "Bearer") super().__init__(*args, **kwargs) register_external_error_handlers(self)