【发布时间】:2015-06-16 15:42:08
【问题描述】:
基本上,我想设置 swagger 在请求中接受这样的东西
[
{
"input_id": "",
"city": "",
"state": "",
"zipcode": "20500"
},
{
"input_id": "",
"city": "Cupertino",
"state": "CA",
"zipcode": ""
},
{
"input_id": "",
"city": "",
"state": "",
"zipcode": "95014"
},
{
"input_id": "Apple",
"city": "Cupertino",
"state": "ca",
"zipcode": "90210"
}
]
我的当前设置有一些问题
- name: testing
in: query
description: 'zip request info'
type: array
items:
type: object
properties:
input_id:
type: string
city:
type: string
state:
type: string
zipcode:
type: string
这将设置POST url 以访问这些项目,如下所示
...testing[0][city]=burbank&testing[0][state]=ca...
当我想像这样访问它们时
...city=burbank&state=ca... 对于每个城市/州/邮政编码/input_id 对。
更新:
我的新设置正在运行,除了招摇所引发的错误。但它确实有效!
- name: City/State pair or ZIP Code
in: body
description: 1 or more
type: array
items:
minimum: 1
type: object
properties:
input_id:
type: string
description: A unique identifier for this address used in your application; this field will be copied into the output
city:
type: string
description: The city name
state:
type: string
description: State name or abbreviation
zipcode:
type: string
description: The 5-digit ZIP Code
如果有人能找到比这更好的解决方案(没有错误),请告诉我
【问题讨论】: