我在数据库的json
列中保存了以下JSON数组:
{
"0": {
"h": "500",
"w": "400",
"x": "300",
"y": "200"
},
"1": {
"h": "500",
"w": "400",
"x": "350",
"y": "100"
}
}
在我的Swagger.yml文件中,对于正文,我有以下内容:
parameters:
- in: body
name: body
description: bla bla
required: true
schema:
type: object
required:
- coordinates
properties:
coordinates:
type: object
items:
type: object
items:
type: number
如果我提交这个,我的Python应用程序会出现以下错误:
validation error: [{'h': '500', 'w': '400', 'x': '300', 'y': '200'}, {'h': '500', 'w': '400', 'x': '350', 'y': '100'}] is not of type 'object'
如果我将数据库中的原始JSON数组更改为从“1”开始,例如:
{
"1": {
"h": "500",
"w": "400",
"x": "300",
"y": "200"
},
"2": {
"h": "500",
"w": "400",
"x": "350",
"y": "100"
}
}
它被成功地接收为:
{"1": {"h": "500", "w": "400", "x": "300", "y": "200"}, "2": {"h": "500", "w": "400", "x": "350", "y": "100"}}
我做错什么了
目前没有回答
相关问题 更多 >
编程相关推荐