express-openapi-validator
express-openapi-validator copied to clipboard
multipart/form-data with application/json field doesn't work
Given a route specification with the following request body:
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object`
required:
- image
- json
properties:
image:
type: string
format: binary
json:
$ref: '#/components/schemas/MySchema'
encoding:
image:
contentType: image/*
json:
contentType: application/json
I get the following error:
request.body.json should be object {
"errors":[{
"errorCode":"type.openapi.validation",
"message":"should be object",
"path":".body.json"
}],
"name":"Bad Request",
"status":400
}
I facing the same issue :( Is there a fix?
See this issue for a workaround :
https://github.com/cdimascio/express-openapi-validator/issues/820