Open Service84Tyler opened 2 years ago
The expected output is to generate files that do not cause IDE warnings The actual output is java files that include unused imports which cause IDE warnings
I bump the issue, so many warning make the code really difficult to read.
Regards, S.
I gave the problem a shot in #13650 and #13582 but encountered some edge cases
Bug Report Checklist
Description
The files generated from JavaSpring api.mustache, apiController.mustache, apiDelegate.mustache, and model.mustache have unused imports. I generate the API stubs on compile so I can't manually remove unused imports, because they will just come back on the next compile. I am also using STS/eclipse and I am striving for a spotless build so the unused import warnings are a nuisance and potentially hide important warnings.
openapi-generator version
I am using 4.2.3, and 6.0, This also appears in master. I don't believe this is a regression
Version 6.0.0 Generator: spring Library: spring-boot Gradle: 6.9 Java version: 11
OpenAPI declaration file content or url
https://petstore.swagger.io/v2/swagger.json
Generation Details
Then import into STS/eclipse and you will see the many unused import warnings
Related issues/PRs
I will propose with the suggested fix
12578
Suggest a fix
Add
@SuppressWarnings(value = {"unused"})