[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);
}