Skip to content

Cannot generate MultipartForm server-side APIΒ #1154

@luca-vercelli

Description

@luca-vercelli

Tell us the extension you're using

Server

I tried this:

I tried to generate an API such this:

paths:
  /mypath:
    post:
      operationId: mymethod
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file1:
                  type: string
                  format: binary
                file2:
                  type: string
                  format: binary
  responses:
    '200':
      description: OK
      content:
        application/pdf:
          schema:
            type: string
            format: binary

I tried with or without the option:

quarkus.openapi-generator.codegen.spec.openapi_yaml.skip-form-model=false

This happened:

This is what I get:

    @POST
    @Produces("application/pdf")
    @Consumes("multipart/form-data")
    Response mymethod(@NotNull InputStream data);

I expected this:

I was expecting something like @MultipartForm input data.

Documentation of client-side code generator tells that multipart forms are supported. Documentation of server-side code generator does not talk about it. Is this supported or not?

Is there a workaround?

No response

How can we try to reproduce the issue?

In my POM there is at least this:

    <quarkus.platform.version>3.19.2</quarkus.platform.version>
   ...
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-rest-jackson</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-smallrye-openapi</artifactId>
    </dependency>
    <dependency>
        <groupId>io.quarkiverse.openapi.generator</groupId>
        <artifactId>quarkus-openapi-generator-server</artifactId>
        <version>2.9.0</version>
    </dependency>

Anything else?

No response

Output of uname -a or ver

Windows 11

Output of java -version

java version "17.0.6" 2023-01-17 LTS

Quarkus OpenApi version or git rev

2.9.0

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.0

Additional information

No response

Community Notes

  • Please vote by adding a πŸ‘ reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.name: Bug Report 🐞

Metadata

Metadata

Assignees

Labels

added to backlogThe issue was added to backlogarea:serverThis item is related to the server extensionpinnedIssues and PRs that must not stale

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions