1

trying to get a name of an array field to show up. trying to the following:

{
  history: []
}

and I have in my doc:

      responses:
        '200':
          description: OK
          schema:
            $ref: '#/definitions/historyList'

in definitions...

  historyList:
    type: array
    items:
      $ref: '#/definitions/History'  #my object of many values

I have tried the name on the schema level in the response, and in the array itself, and it always just comes through as "array". The swagger doc, there has to be something obvious I am missing on this.

Thanks

1 Answer 1

4

And, as always, I post a question and then figure it out 10 minutes later....

So, its not obvious, but here is how I named my array "history"

historyList:
  type: object
  properties:
    history:
      type: array
      items:
        $ref: '#/definitions/history'

So you need to put your array in an object and name the object.

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.