express-openapi-validator
express-openapi-validator copied to clipboard
JSON in queries defined to be JSON object produces "must be object" error
Describe the bug Using content.application/json to describe a JSON object within a query string just gives "must be object" error, even with swagger ui
To Reproduce
Have the following or similar inside the parameters section of a get schema:
- name: a
required: true
in: query
content:
application/json:
schema:
type: object
properties:
b:
type: string
c:
type: string
d:
type: string
required: ["b", "c", "d"]
Run and try to hit the endpoint with ?a={"b":"b","c":"c","d":"d"} or open the inbuilt swagger ui server, even this gives examples which makes its own server fail in the same way.
Actual behavior validator barfs with "a must be object"
Expected behavior validation successful passing in the correct object to the request
Workaround: pass as string and validate with some other library once you get into the request, but this is suboptimal as this library was supposed to do that part.