Bug Report Checklist
Description
After upgrading to OpenAPI Generator 7.11.0, a regression has been introduced that affects custom generators extending SpringCodegen (info about custom generators).
When generating models, the import for org.springframework.lang.Nullable is not being added, even though the annotation is used in the generated code. This results in compilation errors out of the box.
This is a breaking change introduced in a minor version, which violates semantic versioning expectations. Custom generators that previously worked are now broken after upgrading, without any clear migration notes or warnings.
openapi-generator version
7.11.0
✅ Expected Behavior
Generated code should include the necessary import for org.springframework.lang.Nullable and compile without issues.
❌ Actual Behavior
The generated code uses @Nullable, but the import is missing, leading to compilation errors.
Steps to reproduce
- Create a custom generator that extends
org.openapitools.codegen.languages.SpringCodegen.
- Generate model classes with nullable properties.
- Try to compile the generated output.
Workaround
As a temporary workaround, add this override method in your custom generator:
@Override
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
super.postProcessModelProperty(model, property);
model.imports.add("Nullable");
}
Related issues/PRs
Bug Report Checklist
Description
After upgrading to OpenAPI Generator 7.11.0, a regression has been introduced that affects custom generators extending
SpringCodegen(info about custom generators).When generating models, the import for
org.springframework.lang.Nullableis not being added, even though the annotation is used in the generated code. This results in compilation errors out of the box.This is a breaking change introduced in a minor version, which violates semantic versioning expectations. Custom generators that previously worked are now broken after upgrading, without any clear migration notes or warnings.
openapi-generator version
7.11.0
✅ Expected Behavior
Generated code should include the necessary import for
org.springframework.lang.Nullableand compile without issues.❌ Actual Behavior
The generated code uses
@Nullable, but the import is missing, leading to compilation errors.Steps to reproduce
org.openapitools.codegen.languages.SpringCodegen.Workaround
As a temporary workaround, add this override method in your custom generator:
Related issues/PRs