我收到包含以下内容的List<Image>
张图片的回复。
{
images: [
{
"name": "ABC",
"content": "This is text"
},
{
"name": "ABC",
"content": "This is text"
}
]
}
YAML
文件类似于以下示例。以下YAML
文件是否有效并等效于上述图像JSON响应?
responses:
'200':
description: 'Request is successful.'
schema:
$ref: '#/definitions/Images'
definitions:
Images:
type: array
items:
$ref: '#/definitions/Image'
Image:
type: object
properties:
name:
type: string
content:
type: string
required:
- name
- content
答案 0 :(得分:1)
响应模式缺少包装器属性images
。除此之外,您的定义是正确的。
如下更改您的Images
模式:
definitions:
Images:
type: object
properties:
images:
type: array
items:
$ref: '#/definitions/Image'
required:
- images