[BUG][JavaSpring] description values for @Operation annotation are not generated from OpenAPI definition
Created by: ziegler-daniel
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When I run code generation for a Java Spring Api, the description is missing in the @Operation
annotation.
openapi-generator version
The bug occurs with the latest openapi-generator version.
OpenAPI declaration file content or url
The bug can be reproduced for example with this file: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/java/petstore-group-parameter.yaml
Generation Details
Command to generate the code: java -jar openapi-generator-cli-6.3.0-20221110.220613-11.jar generate -i modules/openapi-generator/src/test/resources/3_0/java/petstore-group-parameter.yaml -g spring -o test
Steps to reproduce
Run the code generation command from above.
Output:
...
@Operation(
operationId = "findPetsByStatus",
summary = "Finds Pets by status",
tags = { "pet" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
}),
@ApiResponse(responseCode = "400", description = "Invalid status value")
},
security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "read:pets" })
}
)
...
Expected output:
...
@Operation(
operationId = "findPetsByStatus",
summary = "Finds Pets by status",
description = "Multiple status values can be provided with comma separated strings",
tags = { "pet" },
responses = {
@ApiResponse(responseCode = "200", description = "successful operation", content = {
@Content(mediaType = "application/xml", schema = @Schema(implementation = Pet.class)),
@Content(mediaType = "application/json", schema = @Schema(implementation = Pet.class))
}),
@ApiResponse(responseCode = "400", description = "Invalid status value")
},
security = {
@SecurityRequirement(name = "petstore_auth", scopes={ "read:pets" })
}
)
...
Related issues/PRs
The bug has already been reported with the closed issue https://github.com/OpenAPITools/openapi-generator/issues/11779, but the fix was not correct as mentioned in the discussion.
Suggest a fix
PR with a fix: https://github.com/OpenAPITools/openapi-generator/pull/13995