OpenAPITools / OpenAPITools/openapi-generator

[BUG][java-helidon-server] PartsUtils#partsMap does not work correctly

Open
#21,869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

When using a multipart form data upload the generated service uses PartsUtils#partsMap to grab all the parts by name then validates and passes the parts to the generated method.

However, when iterating over MultiPart Helidon will finish() the previous part before returning the next one, causing an error when accessing the parts from the Map

Cannot request input stream more than once

openapi-generator version

7.15.0

OpenAPI declaration file content or url
paths:
  "/mutipart":
    post:
      requestBody:
        required: true
        content:
          "multipart/form-data":
            schema:
              type: object
              properties:
                csvFile:
                  type: string
                  format: binary
              required:
                - csvFile
            encoding:
              csvFile:
                contentType: text/csv
Generation Details

Using Maven plugin

      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <generatorName>java-helidon-server</generatorName>
              <generateModels>false</generateModels>
              <configOptions>
                <fullProject>false</fullProject>
                <library>se</library>
                <useAbstractClass>true</useAbstractClass>
              </configOptions>
            </configuration>
          </execution>
        </executions>
      </plugin>
Steps to reproduce

Try to read the data from a ReadablePart in a generated service

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with PartsUtils#partsMap and reproduce the issue using the provided multipart OpenAPI declaration and Maven plugin configuration. Trace how the generated service accesses ReadablePart values after iteration over MultiPart. Done means generated multipart services can read parts from the map without the “Cannot request input stream more than once” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.