OpenAPITools / OpenAPITools/openapi-generator

[REQ] [java] Fluent client method builder

Open
#18,186 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

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

N/A

Describe the solution you'd like

I'd like to have an option to allow generation of fluent builders for each operation.

This might tie well with #18032.

Describe alternatives you've considered

I can emulate this with a custom template that adds Lombok's Builder on instance methods, with builder class name and build method name that reference operatioId and the 2 variant suffixes. Change build method to something like invoke and you have something that works.

Additional context

Making this a feature here instead of relying on Lombok means we could generate staged builders for handling required parameters.

I'd like this backported to 6.x.

If you find it worthwhile, on a more general purpose level, some kind of parameter object + staged builder combo annotation processor might be more useful for the community at large.

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

Start by reading issue #18032 and reviewing how the existing custom-template approach generates Java operation methods. Define the scope for fluent and staged builders, including required parameters, operationId-based names, variant suffixes, and the requested 6.x backport; completion should include an agreed design and coverage for generated clients.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
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.