swagger-api / swagger-api/swagger-codegen-generators

[Java/spring] multipart/form-data in requestBody does not generate anything

Open
#763 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Since 3.0.21, code generation for multipart/form-data in requestBody does not generate any @RequestPart input param in the java interface.

    post:
      tags:
        - ads  dataset request
      summary: ...
      description: ...
      operationId: createDatasetRequest
      security:
        - basicAuth: []
      parameters:
        - in: query
          name: scheduling
          schema:
            type: string
            example: '0 8 * * *'
        - in: query
          name: startDate
          schema:
            type: string
            format: date-time
        - in: query
          name: endDate
          schema:
            type: string
            format: date-time
      requestBody:
        content:
          multipart/form-data:
            schema:
              properties:
                file:
                  type: string
                  format: binary
        required: true
      responses:
        '201':
          description: ...
          content:
            text/plain:
              schema:
                type: string
                example: e59f329a-d911-4bd1-89ee-e8e922ca632c
        default:
          description: ...
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDTO'

It was working in 3.0.20.

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 by reproducing the supplied OpenAPI multipart/form-data example with the Java Spring generator, comparing output from 3.0.20 and 3.0.21. Trace the generator path responsible for requestBody parameters and verify that the generated interface includes the file input as an @RequestPart parameter.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.