我在 swagger yaml 中定义对象数组时遇到问题。每次我尝试定义类型时,Swagger 编辑器都会出错:yaml 的数组部分。我定义了它,但它不正确,因为它给出了错误。以下是我试图在 swagger yaml 中定义的 json。
{
"CountryCombo": {
"options": {
"option": [{
"id": "GB",
"value": "GB Great Britain"
}, {
"id": "US",
"value": "US United States"
}, {
"id": "AD",
"value": "AD Andorra, Principality of"
}]
}
}
}
我像这样将这个json定义为swagger yaml,但它给出了一个错误:
CountryCombo:
type: object
properties:
options:
type: object
properties:
option:
type: array
items:
- id:
type: string
description: GB
value:
type: string
description: GB Great Britain
- id:
type: string
description: US
value:
type: string
description: US United States
- id:
type: string
description: AD
value:
type: string
description: AD Andorra, Principality of
谁能建议我如何按照招摇规范在 yaml 中定义这个 json?