跳转至

配置

Flask supports many configurations, and there are also some configurations in this library that can be used.

SWAGGER_CONFIG⚓︎

You can change the default behavior of the Swagger UI.

1
2
3
4
5
6
7
8
from flask_openapi3 import OpenAPI

app = OpenAPI(__name__)

app.config["SWAGGER_CONFIG"] = {
    "docExpansion": "none",
    "validatorUrl": "https://www.b.com"
}

Here are more configuration options for Swagger UI, which you can find here.

OAUTH_CONFIG⚓︎

You can configure OAuth 2.0 authorization for Swagger UI.

1
2
3
4
5
from flask_openapi3 import OpenAPI

app = OpenAPI(__name__)

app.config["OAUTH_CONFIG"] = {"clientId": "xxx", "clientSecret": "xxx"}

Here are more configuration options for OAuth 2.0 configuration, which you can find here.