我有一个json有效载荷,我需要一些关于如何在swagger-YAML中表示它的帮助
关键字可以是空数组[]或数组,如['a','b','c']
这是我的对象
{
"keywords": [],
"distance": "25",
"jobType": "all",
"sectorId": "0",
"location": {
"lat": "33.7489954",
"lng": "-84.3879824",
"name": "Atlanta, GA"
}
}
这是我到目前为止所得到的错误
SyntaxError: Data does not match any schemas from "oneOf"
Data path: "/paths/~1users~1{userId}~1jobdeckSearch/get/responses/200"
Schema path: "/properties/paths/patternProperties/^~1/properties/get/properties/responses/patternProperties/^([0-9]{3})$|^(default)$/oneOf"
responses:
200:
schema:
type: object
properties:
distance:
type: string
keywords:
type: array
items:
type: string
jobType:
type: string
sectorId:
type: string
location:
properties:
lat:
type: string
lng:
type: string
name:
type: string
答案 0 :(得分:1)
响应代码需要description
:
responses:
200:
description: OK
schema:
...
此外,删除lat
和lng
之前的额外空格字符 - 它们需要缩进到与name
相同的级别。
除此之外,你的定义很好。