Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2474
Closed
Open
Issue created Mar 21, 2019 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[BUG] [Java | JaxRS-Jersey] Bad file upload code generation

Created by: Evilong

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

The return generated for a POST method that takes a file as input and file as output don't match the generated class method. Has two invalid arguments (bodyInputStream and bodyDetail) instead of body

public Response getApplication(@ApiParam(value = "input APK" ,required=true) @Valid File body,@Context SecurityContext securityContext) throws NotFoundException {
        return delegate.getApplication(bodyInputStream, bodyDetail,securityContext);
    }
openapi-generator version

4.0.0-beta2

OpenAPI declaration file content or url
/getApplication:
    post:
      operationId: getApplication
      summary: getting application
      tags: ['Android']
      requestBody:      
        description: input APK
        required: true
        content:
          application/vnd.android.package-archive:
            schema:
              type: string
              format: binary
      responses:
        '200':
          description: output APK
          content:
            application/vnd.android.package-archive:
              schema:
                type: string
                format: binary
Command line used for generation
openapi-generator generate -i .\api-specs.yaml -g jaxrs-jersey -o ./tmp/test/
Output
@POST
    
    @Consumes({ "application/vnd.android.package-archive" })
    @Produces({ "application/vnd.android.package-archive" })
    @io.swagger.annotations.ApiOperation(value = "getting application", notes = "", response = File.class, authorizations = {
        @io.swagger.annotations.Authorization(value = "ApiKeyAuth")
    }, tags={ "Android", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "output APK", response = File.class) })
    public Response getApplication(@ApiParam(value = "input APK" ,required=true) @Valid File body
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.getApplication(bodyInputStream, bodyDetail,securityContext);
    }
Expected Output
@POST
    
    @Consumes({ "application/vnd.android.package-archive" })
    @Produces({ "application/vnd.android.package-archive" })
    @io.swagger.annotations.ApiOperation(value = "getting application", notes = "", response = File.class, authorizations = {
        @io.swagger.annotations.Authorization(value = "ApiKeyAuth")
    }, tags={ "Android", })
    @io.swagger.annotations.ApiResponses(value = { 
        @io.swagger.annotations.ApiResponse(code = 200, message = "output APK", response = File.class) })
    public Response getApplication(@ApiParam(value = "input APK" ,required=true) @Valid File body
,@Context SecurityContext securityContext)
    throws NotFoundException {
        return delegate.getApplication(body ,securityContext);
    }
Assignee
Assign to
Time tracking