我正在尝试以这种格式形成一个招摇的文档。响应是 200 http 代码上的以下 json。我无法形成如下所示的 json。
[
{
"key":"test1",
"val":"val1"
},
{
"key":"test2",
"val":"val2"
},
{
"key":"test3",
"val":"val3"
}
]
到目前为止,我有这个:
"responses": {
"200": {
"description": "response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/res1",
"$ref": "#/definitions/res2"
}
}
}
}
"definitions": {
"res1": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "test1"
},
"keyURL": {
"type": "string",
"example": "val1"
}
}
},
"res2": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "test2"
},
"val": {
"type": "string",
"example": "val2"
}
}
}
但我res2
根本看不到块。我只是看到res1