Skip to content

[BUG] [JAVA] 7.3.0 adds @lombok.NonNull on all required fields when any lombok annotation is included #17831

Description

@Squeeeez

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

#17622 adds more lombok support, which is great!
As soon as any lombok annotation is included, every required field on the models now gets annotated with @lombok.NonNull
which adds a null check where none was present before (i.e. with 7.2.0) when using for example a lombok constructor or builder.

As such a breaking change which suddenly starts throwing NullPointerExceptions where none were thrown before it would be nice to have a way to configure such behaviour.

openapi-generator version

7.3.0-SNAPSHOT

OpenAPI declaration file content or url

The yaml configuration
The generated sample

Generation Details

bin/config-generate-samples.sh bin/configs/spring-boot-lombok-tostring.yaml

Steps to reproduce

Include any lombok class in additionalModelTypeAnnotation, mark a model attribute as required

Suggest a fix

I would suggest the use of a configuration possibility similar to useBeanValidation, either to disable @lombok.NonNull, or to choose which library is used for such Nullable/NonNull annotations. What are your thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions