-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [JAVA] regressions introduced by #17622 (lombok) #17793
Comments
@jpfinne thanks for you comments. |
So we agree that the generated java code should behave the same as some hand written pojo annotated with lombok. IMHO it is better to add these 2 features in mustache code. |
The story of constraints that are not generated when using data is disturbing. I hope it will be fixed as soon as possible |
Bug Report Checklist
Description
#17622 allows the use of lombok. It works for simple cases but I don't think it is production ready.
There are multiple regressions
@Valid
...openapi-generator version
7.3.0-SNAPHOT
OpenAPI declaration file content or url
Here the generated LombokData.java
compared to the non lombok version:
Generation Details
java -jar openapi-generator-cli.jar generate -g spring -i issue_lombok.yaml -p additionalModelTypeAnnotations='@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor;@lombok.Builder'
Steps to reproduce
Build with 7.3.0-SNAPSHOT with lombok additionalModelTypeAnnotations
java -jar openapi-generator-cli.jar generate -g spring -i issue_lombok.yaml -p additionalModelTypeAnnotations='@lombok.Data;@lombok.NoArgsConstructor;@lombok.AllArgsConstructor;@lombok.Builder'
Related issues/PRs
#17622
Suggest a fix
Fix the different pojo.mustache with
Constraints on the field
lombok superBuilder for inheritance
javadoc on the field
@JsonProperty on the field (using
@Getter(onMethod=@__({@JsonProperty("extra-data")}))
)General question: Do we really need a openapi generator that needs lombok to create java classes?
pojo.mustache is already complex.
Configuring lombok is also complex. How to generate for example
@Builder(toBuilder=true)
?Lombok is nice when writing code. Here the openapi generator does the job.
The only valid reason I see is the lack of the builder pattern in the current pojo.mustache.
It can be introduced. The generated code can be equivalent or better than a lombok annotated class.
IMHO it will be easier to implements new features without the extra lombok handling (immutability, records, genericity, merging the different java generators...)
The text was updated successfully, but these errors were encountered: