ソースを参照

feat: add authorizations for swagger doc (#24518)

tags/1.8.0
非法操作 2ヶ月前
コミット
d7869a4d1e
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更11行の追加0行の削除
  1. 11
    0
      api/libs/external_api.py

+ 11
- 0
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)

読み込み中…
キャンセル
保存