Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
melocotton opened this issue Sep 23, 2020 · 1 comment

Comments

@melocotton
Copy link

melocotton commented Sep 23, 2020

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.

@jjaros
Copy link

jjaros commented Feb 13, 2021

Hi, it seems like a bug of swagger-codegen-generators (specially in io.swagger.codegen.v3.generators.java.SpringCodegen#addCodegenContentParameters) and it should be fixed in next release - see 873f695#diff-1413e682f4e318f3a61ea2ee5a3dac03d16a276d8a62b701993dfcf31d44da95

Just now, as a simple workaround you can create custom generator that will override SpringCodegen#addCodegenContentParameters and will handle also formParams - e.g. as is in related commit changes.

Cc: @HugoMario

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants