express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

deepObject array property is converted to string

Open ownagedj opened this issue 3 years ago • 1 comments

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.

ownagedj avatar Sep 07 '21 12:09 ownagedj

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.

saimonmoore avatar Jan 05 '22 10:01 saimonmoore