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

Multipart FormData - Boolean validation issue

Open elvince opened this issue 1 year ago • 2 comments

Describe the bug If I send a multipart form data (File + Body), the body validation failed due to a boolean in it.

To Reproduce Send a multipart form data with boolean in it. Add the validation middleware with a boolean required in the validatin schema.

Actual behavior Failed with "XXX must be boolean" while the value is "true" in the form data string.

Expected behavior This validation should not failed as coercevalues is set to true by default.

I saw different issue on this in the past, may be there was a regression somewhere? or in AJV?

thanks,

elvince avatar Oct 08 '24 09:10 elvince

by reading again the docs, it seems that coercevalue is not applied to body, is that correct?

If so, how should we handle this case?

Thanks,

elvince avatar Oct 08 '24 12:10 elvince

Any tips to solve this case?

elvince avatar Oct 24 '24 14:10 elvince