Hilzu / express-openapi-validate

Express middleware to validate requests based on an OpenAPI 3 document
Apache License 2.0
75 stars 12 forks source link

Path Params and QueryString parameters only support type string #46

Closed bemisguided closed 4 years ago

bemisguided commented 5 years ago

Express only parses both Path Params and Query String parameters as strings. This limits the ability to use the various supported types – specifically number and boolean being the most applicable – as the validator will fail if these provided parameters do not exactly match the JavaScript type.

I am happy to look at implementing this but would like to socialize the paths to essentially loosen the rules to accomadate Express here.

FaresAbu-Khiarah commented 5 years ago

Having the same issue here with the array type

Hilzu commented 5 years ago

One option is to coerce the types in Ajv using the steps provided in this issue: https://github.com/Hilzu/express-openapi-validate/issues/42