feat: add authorizations for swagger doc (#24518)
This commit is contained in:
@@ -106,6 +106,17 @@ def register_external_error_handlers(api: Api) -> None:
|
|||||||
|
|
||||||
|
|
||||||
class ExternalApi(Api):
|
class ExternalApi(Api):
|
||||||
|
_authorizations = {
|
||||||
|
"Bearer": {
|
||||||
|
"type": "apiKey",
|
||||||
|
"in": "header",
|
||||||
|
"name": "Authorization",
|
||||||
|
"description": "Type: Bearer {your-api-key}",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
kwargs.setdefault("authorizations", self._authorizations)
|
||||||
|
kwargs.setdefault("security", "Bearer")
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
register_external_error_handlers(self)
|
register_external_error_handlers(self)
|
||||||
|
Reference in New Issue
Block a user