【发布时间】:2015-09-22 19:14:03
【问题描述】:
我正在尝试使用 Swagger 定义一个接受实际文件和描述文件内容的模式对象的 API。这是 Swagger YAML 的 sn-p。但是,它不会在 Swagger 编辑器中验证。
/document:
post:
summary: Api Summary
description: Api Description
consumes:
- multipart/form-data
parameters:
- name: documentDetails
in: formData
description: Document Details
required: true
schema:
$ref: '#/definitions/Document'
- name: document
in: formData
description: The actual document
required: true
type: file
Swagger 编辑器抛出以下验证错误:
Swagger 错误:数据与“oneOf”中的任何架构都不匹配
我错过了什么吗?或者这不是 Swagger 支持的功能吗?
【问题讨论】:
-
想要做同样的事情,上传一个带有 json doc 的文件,服务器与 doc 一起存储。你有没有想出一个可以分享的解决方法?谢谢。
标签: swagger swagger-2.0 openapi