mirror of https://github.com/langgenius/dify.git
feat: add authorizations for swagger doc (#24518)
This commit is contained in:
parent
aa71f88e1b
commit
d7869a4d1e
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue