Swagger 大摇大摆如何正确定义文件下载操作

Swagger 大摇大摆如何正确定义文件下载操作,swagger,swagger-codegen,swagger-editor,Swagger,Swagger Codegen,Swagger Editor,我在OpenAPI3.0中使用在线Swagger编辑器,我必须创建一个下载的定义文件。我开发服务器端,客户应该能够使用YAML描述创建客户机,而无需我的“附加说明”。YAML的相关部分是: /files/download/{fileName}: get: summary: download file operationId: downloadFile description: this API is for file download parameters: - in:

我在OpenAPI3.0中使用在线Swagger编辑器,我必须创建一个下载的定义文件。我开发服务器端,客户应该能够使用YAML描述创建客户机,而无需我的“附加说明”。YAML的相关部分是:

/files/download/{fileName}:
get:
  summary: download file
  operationId: downloadFile
  description: this API is for file download
  parameters:
    - in: path
      name: fileName
      schema:
        type: string
      required: true
      description: The name of file to download
  responses:
    200:
      description: Operation performed successfully.
      content:
        application/octet-stream:
          schema:
            type: string
            format: binary
   ...
问题是:

  • 内容。目前,它被定义为八进制流,作为最常见的类型,但实际上它取决于一些预定义的文件类型集中的文件类型。有没有办法定义这种映射(文件类型/内容类型)并将其与内容标记一起使用

  • 响应头应包括键/值对附件或内联和文件名。文件名在路径-{fileName}中定义。有没有办法描述枚举{attachment,inline}和文件名值的连接