在python flasgger中,如何在web界面默认展开schema?

问题描述 投票:0回答:0

我已经开始使用 Swagger 来编写 API 文档。请帮我配置一下。如何在 Swagger UI 中默认展开 schema?

from flasgger import Swagger, swag_from
from flask import Flask

app = Flask(__name__)
swagger = Swagger(app)


@swag_from("example.yml", methods=["GET"])
@app.route("/")
def example():
    return "Hello World!"


if __name__ == "__main__":
    app.run()

例子.yml

responses:
  '200':
    description: Successful response
    schema:
      type: object
      properties:
        data:
          type: object
          properties:
            messages:
              type: array
              items:
                type: object
                properties:
                  level:
                    type: string
                  title:
                    type: string
                  uid:
                    type: integer
                  value:
                    type: string

http://127.0.0.1:5000/apidocs

默认情况下,此示例显示折叠模式模型数据:

但我需要默认展开它,比如:

python swagger-ui flasgger
© www.soinside.com 2019 - 2024. All rights reserved.