Reputation: 2772
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
Upvotes: 1
Views: 1553
Reputation: 2772
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.
Upvotes: 4