pulumi / pulumi/pulumi-java

Accept Builder to avoid build() call

Open
#244 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api/suggestion area/languages kind/enhancement
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Could add overloads to methods accepting Foo to also accept
FooBuilder, avoiding the build() method call at the end.

Before:

ServiceArgs.builder()
    .setMetadata(ObjectMetaArgs.builder()
        .clusterName("clusterName")
        .build())

After:

ServiceArgs.builder()
    .setMetadata(ObjectMetaArgs.builder()
        .clusterName("clusterName"))

Lifting @pawelprazak's idea to an issue. We can do this, it's syntactic sugar that costs some size in the generated SDKs but may be worth it.

Affected area/feature

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 locating the Java SDK generation code that produces methods accepting Foo and the corresponding FooBuilder, then trace how builder() and build() are represented in generated APIs. Done means callers can use the nested builder directly in examples like setMetadata without an explicit build() call, with generated SDK size considered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.