【发布时间】:2017-10-08 04:18:12
【问题描述】:
试图用大摇大摆的定义让这个 Json 胜出:
{
"attachments":[{
"attachment":
{
"filename": "string",
"filedata": "string",
"filetype": "string"
}
},
{
"attachment":
{
"filename": "string",
"filedata": "string",
"filetype": "string"
}
}]
}
我的 swagger.json 看起来像这样:
"attachments": {
"type":"array",
"items": {
"$ref": "#/definitions/attachment"
}
},
"attachment": {
"type": "object",
"properties": {
"filename": {
"type": "string"
},
"filedata": {
"type": "string"
},
"filetype": {
"type": "string"
}
}
},
我根据请求得到了这个 Json:
"attachments": [
{
"filename": "string",
"filedata": "string",
"filetype": "string"
}
],
如何通过 Swagger 引用获得第一个 Json 语法?
【问题讨论】:
-
您说的是“嵌套数组”,但您的第一个示例是对象/哈希图。哪一个是正确的?
-
对不起,我们的目标是得到一个数组,我用正确的语法编辑了这个问题。谢谢。
标签: json swagger swagger-2.0