Skip to content
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] [java] create a builder pattern for the models #18032

Closed
jpfinne opened this issue Mar 5, 2024 · 0 comments · Fixed by #18650
Closed

[REQ] [java] create a builder pattern for the models #18032

jpfinne opened this issue Mar 5, 2024 · 0 comments · Fixed by #18650

Comments

@jpfinne
Copy link
Contributor

jpfinne commented Mar 5, 2024

Is your feature request related to a problem? Please describe.

A good builder pattern generation can solve many issues:

  • initialize readonly values in the java generator
  • make it similar to the lombok builder that people are used to.
  • introduce immutability

Lombok can be used the generate builders. But the introduction of lombok creates more issues (#17793)

Describe the solution you'd like

Add a builder inner class
Add a static builder() method
Add a toBuilder() method

Describe alternatives you've considered

Reuse the builder from javaJAXRSServerCodeGen.
Fix the lombok generation issues.

wing328 added a commit that referenced this issue May 14, 2024
… generator (#18650)

* add builder pattern to java client and spring generator

* regenerate samples

* update doc

---------

Co-authored-by: jpfinne <jeanpaul@finne.be>
renatomameli pushed a commit to renatomameli/openapi-generator that referenced this issue May 17, 2024
…t and spring generator (OpenAPITools#18650)

* add builder pattern to java client and spring generator

* regenerate samples

* update doc

---------

Co-authored-by: jpfinne <jeanpaul@finne.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment