Open fabien-renaud opened 2 years ago
When using $ref on array schema, it only validate (and apply default value to) the first item, ignoring others.
$ref
array
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.
requestBody
When using
$ref
onarray
schema, it only validate (and apply default value to) the first item, ignoring others.Example
This works
This also works
This issue only occurs when using
$ref
onarray
, it works well when declaring schema directly on therequestBody
, not using$ref
.