OpenAPITools / OpenAPITools/openapi-generator

[REQ] Add builder() to data classes for easier creation

Open
#10,841 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

At the moment you have to create instance of object beforehand and then set parameters on it... Can you add Builder to classes (similar to what lombok has).

So instead of doing it like this:
Class1 test = new Class1();
test.setClass2(new Class2().id("test").something('hshj"));

you could use sometjing like this

Class1 test = Class1.builder()
.class2(Class2.builder().id("test").build())
.build();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or generation entry points. Start by locating the Java data-model generation path and reviewing how generated classes are structured; done would mean the relevant generated data classes consistently expose a builder-based creation API.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.