hey guys
I am facing a similar issue and I have tried a few options, however, it is not working, would you mind helping me?
That is my YAML
paths:
/makers:
get:
summary: 'Returns a list of makers'
responses:
'200':
description: List of Makers
content:
application/json:
schema:
$ref: '#/components/schemas/Makers'
default:
description: Empty List
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
Makers:
required:
- "key"
- "models"
properties:
key:
type: "string"
example: "Nissan"
models:
type: "array"
items:
type: "object"
properties:
name:
type: "string"
example: "Sentra"
years:
type: "array"
items:
type: "number"
example:
- 2000
- 2001
and that is the response that auto generates from the collection
{
"key": "Nissan",
"models": [
{
"name": "Sentra",
"years": [
2000,
2001
]
},
{
"name": "Sentra",
"years": [
2000,
2001
]
}
]
}
that is the actual return
[
{
"key": "Nissan",
"models": [
{
"model": "Sentra",
"years": [
2000,
2001
]
},
{
"model": "Maxima",
"years": [
2000,
2001
]
},
{
"model": "Skyline",
"years": [
2000,
2001
]
}
]
},
{
"key": "Ford",
"models": [
{
"model": "Taurus",
"years": [
2000,
2001
]
},
{
"model": "Escort",
"years": [
2000,
2001
]
}
]
}
]
I have already tried to add the array type before $ref, or change the makers and models to array and all other combinations, but I couldn’t make something like ( {…},{…} }