Sal*_*zza 6 swagger json-api swagger-2.0
我正在尝试使用Swagger 2.0为端点创建示例响应.
200:
description: Successful response
schema:
type: object
$ref: "#/definitions/User"
examples:
application/vnd.api+json:
- data:
attributes:
full_name: John Appleseed
- data:
attributes:
full_name: Mike Appleseed
Run Code Online (Sandbox Code Playgroud)
我的api消耗和产生application/vnd.api+json,但它不会识别它.如果我删除这些示例,我的规范就可以了.知道如何指定吗?

它尚未完全实现,尽管您可以定义一个这样的示例:
responses:
"200":
description: Successful response
schema:
$ref: '#/definitions/User'
examples:
application/json:
data:
id: 1
attributes:
attr1: value1
attr2: value2
Run Code Online (Sandbox Code Playgroud)
有一个与mime类型相关的bug,你不能使用点,这就是为什么我没有把application/vnd.api + json
| 归档时间: |
|
| 查看次数: |
11767 次 |
| 最近记录: |