Only validate first item when using ref in array
fabien-renaud opened this issue · comments
When using $ref
on array
schema, it only validate (and apply default value to) the first item, ignoring others.
Example
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Todo'
- type: array
items:
- $ref: '#/components/schemas/Todo'
This works
curl --request POST 'localhost:11000/v1/todo' \
--header 'Content-Type: application/json' \
--data-raw '[
{"valide": "json"}, {"valide": "json"}
]'
This also works
curl --request POST 'localhost:11000/v1/todo' \
--header 'Content-Type: application/json' \
--data-raw '[
{"valide": "json"}, {"invalide": "json"}
]'
This issue only occurs when using $ref
on array
, it works well when declaring schema directly on the requestBody
, not using $ref
.