[jaxrs-resteasy] generated code doesn't compile when @Produces contains multiple values
Created by: tnmtechnologies
Description
In case of multiple possible Content-Type values for a response, the values for the Produces annotation are not separated by a coma. It leads to a compilation error.
openapi-generator version
openapi-generator version is 3.0.3
OpenAPI declaration file content or url
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: '#/components/schemas/LocationData'
default:
description: Unexpected error
content:
application/problem+json:
schema:
$ref: './TS29571_CommonData.yaml#/components/schemas/ProblemDetails'
Command line used for generation
java -jar ./openapi-generator-cli-3.0.3.jar generate -i TS29572_Nlmf_Location.yaml -g jaxrs-resteasy -o samples.openapi && (cd samples.openapi; mvn package)
Steps to reproduce
Compilation errors are:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[39,35] '}' expected
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[39,63] class, interface, or enum expected
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[45,12] class, interface, or enum expected
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[45,76] class, interface, or enum expected
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[45,105] class, interface, or enum expected
[ERROR] ...../samples.openapi/src/gen/java/org/openapitools/api/DetermineLocationApi.java:[48,5] class, interface, or enum expected
[INFO] 6 errors
Generated source code looks like:
@io.swagger.annotations.Api(description = "the determine-location API")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaResteasyServerCodegen", date = "2018-07-03T11:18:06.912088700+02:00[Europe/Paris]")
public class DetermineLocationApi {
@Inject DetermineLocationApiService service;
@POST
@Consumes({ "application/json" })
@Produces({ "application/json""application/problem+json" })
@io.swagger.annotations.ApiOperation(value = "Determine Location of an UE", notes = "", response = LocationData.class, tags={ "Determine Location", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Expected response to a valid request", response = LocationData.class),
@io.swagger.annotations.ApiResponse(code = 200, message = "Unexpected error", response = ProblemDetails.class) })
public Response determineLocation(@ApiParam(value = "" ,required=true) InputData inputData,@Context SecurityContext securityContext)
throws NotFoundException {
return service.determineLocation(inputData,securityContext);
}
}
Related issues/PRs
Suggest a fix/enhancement
A fix will be suggested through a pull request.