Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用swagger定义json输出_Swagger - Fatal编程技术网

如何使用swagger定义json输出

如何使用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",

我有一个json负载,我需要一些关于如何在swagger YAML中表示它的帮助

关键字可以是空数组[]或and数组,如['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  

响应代码需要
说明

      responses:
        200:
          description: OK
          schema:
            ...
另外,删除
lat
lng
之前的多余空格字符-它们需要缩进到与
name
相同的级别

除此之外,你的定义很好