【问题标题】:Swagger yaml (openapi-3.0) upload files does not workSwagger yaml (openapi-3.0) 上传文件不起作用
【发布时间】:2021-07-15 03:20:36
【问题描述】:

我正在使用 openapi 3.0 编写 swagger yaml 文件。但是上传文件功能不起作用。 swagger ui 没有按预期显示上传按钮。下面是我的招摇 yaml 代码 sn-p。有人可以帮忙看看吗?谢谢!!!

/uploadfiles:
    post:
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
              - file_list
              - statement_terminator
              properties:
                statement_terminator:
                  type: string
                default_schema:
                  type: string
                encoding_type:
                  type: string
                file_list:
                  type: array
                  items:
                    type: string
                    format: binary
        required: true

【问题讨论】:

    标签: file-upload swagger-ui openapi


    【解决方案1】:

    type: object 添加到您的多部分正文schema

              multipart/form-data:
                schema:
                  type: object    # <------
                  required:
                  - ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-23
      • 1970-01-01
      • 2020-02-26
      • 2021-11-04
      • 2019-01-18
      • 2021-05-21
      • 2019-09-22
      • 1970-01-01
      相关资源
      最近更新 更多