Reputation: 1
I have a REST service to document, and some of them accept simple array like:
[
{ "name":"a" },
{ "class":"b" },
{ "hello":"c" }
]
How do I describe this in the Swagger yaml model section? I can only create 'is_sellerarray' like
{
"is_seller": [
{
"name": "string",
"asim": "string"
}
]
}
Upvotes: 0
Views: 245
Reputation: 582
You can define your own array type. Your Pet object will have name
and asim
as two attributes. Follow documents for more information. https://swagger.io/docs/specification/data-models/
type: array
items:
$ref: '#/components/schemas/Pet'
You can play around online swagger editor to see real time changes. https://editor-next.swagger.io/
Upvotes: 0