以下是代码片段:
/getappsettings:
get:
summary: Gets the collection of app settings.
responses:
200:
description: The successful get app settings response.
schema:
type: array
items:
$ref: '#/definitions/KeyValueType'
example:
- key: 'APP_SUPPORT_EMAIL_ADDRESS'
value: 'test@example.com'
- key: 'APP_SUPPORT_PHONE_NUMBER'
value: '08 9123 4567'在来自SwaggerHub的模拟API中,它返回一个空数组。
发布于 2018-01-24 13:13:56
我发现的问题是它应该是'examples:‘而不是' example :’,并且还需要指定内容类型--下面是工作示例……
以下是代码片段
/getappsettings:
get:
summary: Gets the collection of app settings.
responses:
200:
description: The successful get app settings response.
schema:
type: array
items:
$ref: '#/definitions/KeyValueType'
examples:
application/json:
- key: 'APP_SUPPORT_EMAIL_ADDRESS'
value: 'test@example.com'
- key: 'APP_SUPPORT_PHONE_NUMBER'
value: '08 9123 4567'发布于 2018-02-02 16:50:46
这是SwaggerHub的模拟服务器中的一个错误,该错误已经修复。您的定义现在会生成一个包含指定示例数组的模拟响应。
https://stackoverflow.com/questions/48415233
复制相似问题