Closed mmacai closed 4 years ago
@mmacai Yeah, this is an edge-case that is not handled correctly now.
Take a look at this PR: https://github.com/Zooz/api-schema-builder/pull/29/files (api-schema-builder is a dependency for express-ajv-swagger-validation) Probably we need same thing for request validation as well. If you can submit a PR with test for this, I would be more than happy to review.
@kibertoad sure, I'll put something together.
@kibertoad The change should be in this library or api-schema-builder
? Going through api-schema-builder
codebase and I'm a bit lost.
Hi, I want to use openapi/swagger version 3 and I have couple of endpoints using
multipart/form-data
.Not sure if this is a bug or I'm doing something wrong.
My setup:
Swagger:
Getting this error:
Checked the source code and in
src/middleware.js
->_validateBody
is thisconst validator = methodSchema.body[contentType] || methodSchema.body;
. So it's usingcontent-type
header to get the validator. In my case the value ismultipart/form-data; boundary=--------------------------517000622299074484111234
, but it's expecting onlymultipart/form-data
. Thus it can't access the validator.Did I miss something or it's issue in middleware?