Bug Report Checklist
Description
Compilation error for generated spring-boot generated rest controller.
@Nullable annotation is set for NativeWebRequest. The annotation is not imported in all cases. For example when the operations have only required arguments.
openapi-generator version
7.22.0-SNAPSHOT
OpenAPI declaration file content or url
Generation Details
java -jar openapi-generator-cli.jar generate -g spring --library spring-boot -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output
Steps to reproduce
The generated /tmp/output/src/main/java/org/openapitools/api/UserApiController.java
contains a @Nullable annotation, but no import.
It gives a compilation error
Related issues/PRs
Regression due to #23256
Suggest a fix
Quick fix: remove the annotation from apiController.mustache
Mid term fix:
correclty add @Nullable annotation in all the java and spring generators. The goal is is to avoid false alarms when using JSpecify. Ensure that @Nullable annotations are correctly imported
Bug Report Checklist
Description
Compilation error for generated spring-boot generated rest controller.
@Nullableannotation is set for NativeWebRequest. The annotation is not imported in all cases. For example when the operations have only required arguments.openapi-generator version
7.22.0-SNAPSHOT
OpenAPI declaration file content or url
Generation Details
java -jar openapi-generator-cli.jar generate -g spring --library spring-boot -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/output
Steps to reproduce
The generated
/tmp/output/src/main/java/org/openapitools/api/UserApiController.javacontains a
@Nullableannotation, but no import.It gives a compilation error
Related issues/PRs
Regression due to #23256
Suggest a fix
Quick fix: remove the annotation from
apiController.mustacheMid term fix:
correclty add
@Nullableannotation in all the java and spring generators. The goal is is to avoid false alarms when using JSpecify. Ensure that@Nullableannotations are correctly imported