express-openapi-validator
express-openapi-validator copied to clipboard
deepObject array property is converted to string
Describe the bug
// property tags of the filter parameter
{
filter: {
tags: ['APPLE']
}
}
// is converted to string
{
filter: {
tags: 'APPLE'
}
}
To Reproduce
name: filter
example:
tags:
- APPLE
in: query
style: deepObject
required: false
schema:
type: object
properties:
tags:
type: array
items:
type: string
curl http://localhost/some_path?filter[tags]=APPLE
# is converted to string
curl http://localhost/some_path?filter[tags]=APPLE&filter[tags]=BANANA
# is treated as array
Expected behavior Both should be treated as array.
Seeing the same thing. In our case, we have a request param that is a comma delimited urn list.
Our parameter definition is this:
in: query
name: 'urns'
description: 'Comma-delimited list of urns'
schema:
type: array
items:
type: string
pattern: 'urn:x-bla:xts:briefing:\d+:user:\d+$'
style: form
allowReserved: true
In v3, this would be validated and parsed as an array of strings. In v4, we are getting the original comma-delimited string (but passes validation).
This is preventing us from upgrading to v4.