Skip to content

The OpenAPI validation for "multipart/form-data" is not working properly. #137

Description

@NekiyXX

Version

5.2.0

Context

I have an OpenAPI description for an endpoint with content “multipart/form-data”:

paths:
  /someEndpoint:
    post:
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - someFile
                - someValue
              properties:
                someFile:
                  type: string
                  format: binary
                someValue:
                  type: string
            encoding:
              someFile:
                contentType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

In Vertx 4, this worked correctly, and I received validation errors for required fields:
for example (if missed) BodyProcessorException - "[Bad Request] Validation error for body multipart/form-data: provided object should contain property someValue"

After migrating to Vertx 5, it was broken, and I got the ValidatorException: "The related request does not contain the required body."

io.vertx.openapi.validation.impl.RequestValidatorImpl:
Image
The body in the request for multipart/form-data is always null, and we got an exception for the required body on 148 line.
Or if the body is not required, then all other validation for form fields will be skipped.

Steps to reproduce

No response

Do you have a reproducer?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions