【发布时间】:2017-12-05 20:52:41
【问题描述】:
我在 OpenAPI/Swagger 规范中有以下模型定义:
"definitions": {
"models.Equipment": {
"title": "Equipment",
"type": "object",
"properties": {
"Features": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Feature"
}
},
"Id": {
"type": "integer",
"format": "int64"
},
"IdType": {
"type": "string"
},
"Name": {
"type": "string"
},
"Price": {
"type": "integer",
"format": "int32"
}
}
},
"models.Feature": {
"title": "Feature",
"type": "object",
"properties": {
"Equipments": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Equipment"
}
},
"Id": {
"type": "integer",
"format": "int64"
},
"IdFeature": {
"$ref": "#/definitions/models.Feature"
},
"Name": {
"type": "string"
}
}
}
}
在Feature 模型中,他的Equipments 属性定义为Equipment 模型的数组,但Swagger UI 3.x 将其呈现为空数组[]。到处都在使用Feature 模型,例如Feature 中POST 方法的示例我有这种显示。
这个定义在某些方面不正确吗?
完整的规范在这里:
https://dl.dropboxusercontent.com/s/anjfhgxhr0pfmnu/swagger-bug.json
【问题讨论】:
标签: swagger swagger-ui