jreece
jreece

Reputation: 120

How to declare an object with un-named primitives in swagger?

I need to represent the following array in swagger-2.0, but am unsure how to do it, since I cannot figure out how to declare 'un-named' properties.

For example, here's what I need to define:

coords: [ [ 37.782984, -122.420973 ], [ 37.772309, -122.418555 ], ... ]

How can I define these array-entries in swagger ?

Upvotes: 0

Views: 84

Answers (1)

Navid Shakibapour
Navid Shakibapour

Reputation: 555

If you model it as an array of arrays with two items, it should look like this:

parameters:
  - name: coords
    in: body
    schema:
      type: array
      items:
        type: array
        items:
          type: number
        maxItems: 2
        minItems: 2

Upvotes: 2

Related Questions