如何使用swagger定义json输出
我有一个json负载,我需要一些关于如何在swagger YAML中表示它的帮助 关键字可以是空数组[]或and数组,如['a'、'b'、'c'] 这是我的目标如何使用swagger定义json输出,swagger,Swagger,我有一个json负载,我需要一些关于如何在swagger YAML中表示它的帮助 关键字可以是空数组[]或and数组,如['a'、'b'、'c'] 这是我的目标 { "keywords": [], "distance": "25", "jobType": "all", "sectorId": "0", "location": { "lat": "33.7489954", "lng": "-84.3879824",
{
"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
响应代码需要
说明
:
responses:
200:
description: OK
schema:
...
另外,删除lat
和lng
之前的多余空格字符-它们需要缩进到与name
相同的级别
除此之外,你的定义很好