feat: add authorizations for swagger doc (#24518)

This commit is contained in:
非法操作
2025-08-26 11:41:00 +08:00
committed by GitHub
parent aa71f88e1b
commit d7869a4d1e

View File

@@ -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)