0

I have a json payload and I need some help on how to represent it in swagger-YAML

keywords can be an empty array [] or and array like ['a','b','c']

Here is my object

{
    "keywords": [],
    "distance": "25",
    "jobType": "all",
    "sectorId": "0",
    "location": {
        "lat": "33.7489954",
        "lng": "-84.3879824",
        "name": "Atlanta, GA"
    }
}

This is what I have so far but I am getting the error

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  

1 Answer 1

1

Response codes require a description:

      responses:
        200:
          description: OK
          schema:
            ...

Also, remove the extra space character before lat and lng - they need to be indented at the same level as name.

Other than that, you definition is fine.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.