-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[REQ] Lombok support for models #5447
Comments
Lombok does take away all those bugs for hashCode, toString and equals away, by just adding @DaTa to all pojo's. Greatly simplyfies the generation of models |
Agree with @bartveenstra. I can build lombok support in the java templates. Which would simplify the models. |
I would also love to see Lombok support for models. Although it doesn't make much sense generating code that then generates more code at build time, it will really help unlock features that lombok already provides and won't need to be recreated in this project. Like builders. I work with plenty of teams that hand craft their models using Lombok and being able to generate familiar looking code would help convince them to move over to generated models. And ease their transition without having to re-write all their tests that already use lombok builders. If there is any help you need with getting this across the line please let me know. |
I managed to use lombok modes by modifying the mustache files and use it already in production. I think I will create a new generator for this. |
Looking through some of the other issues, in #324 I see people claim to have managed to use the Lombok builder functionality using the new |
I would not recommend to use that branch. I currently have it like that at the client. |
@com2ghz Which branch are you referring to? I thought that Lombok usage is generic enough that it is applicable to all Java pojo generators, client and server. |
@com2ghz @michaelpro1 @pburls I have this feature here #4026 . It's available since 4.2.3 release |
I have tried first time to use OpenAPI generator and without builder pattern many of developers returned to legacy state. Waiting for improvements to use lombok without using templates for generator. |
Hello, |
No need for this. You can create custom mustache templates that have these lombok annotations.
On the getters we return Optionals when the field is not required. This solves the problem with nullable lists |
Hello, please add @DaTa in your list |
@wing328 @martin-mfg this feature is very useful, the default generated model, introduced so many limitation and issues, especially when we defined complex schema with anyOf oneOf and $ref. |
Can someone provide an example on how to achieve this, may be a working template ? I tried adding lombok annotations in additionalModelTypeAnnotations like this; Observations;
|
@agr-priyanshu This PR was not merged. I will create another PR to implement this. |
Maybe my example will help you |
I created a pull request with support for lombok models that come with certain convenient annotations for immutable models with builders. Currently I implemented this only for spring-mvc.
The problem is that I can't add any reviewer to the pull request.
#5430
The text was updated successfully, but these errors were encountered: