pulumi / pulumi/pulumi-java

Support returning plain values from Java methods

Open
#1,193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/codegen 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

As a provider author I would like to be able to mark methods as plain: true so that my provider's consumers can access their results directly without an Output wrapper.

Further, methods that return a single value only should not be wrapped in a struct, making it as simple as possible to consume.

Methods should be able to return explicit Provider references usable for configuring other resources in the stack, so that methods can be used as factories to simplify complex provider configuration.

Here is a PR implementing plain-valued methods for Node, Python, Go that includes acceptance tests for this feature:
https://github.com/pulumi/pulumi/pull/13592

Borrowing from that PR, the new schema forms is listed below; "tlsProvider" returns a singleton provider reference, "meaningOfLife" returns a singleton integer, and "objectMix" returns both in a struct.

  "functions": {
    "metaprovider:index:Configurer/tlsProvider": {
      "inputs": {
        "properties": {
          "__self__": {
            "$ref": "#/resources/metaprovider:index:Configurer"
          }
        }
      },
      "outputs": {
        "$ref": "/tls/v4.10.0/schema.json#/provider",
        "plain": true
      }
    },
    "metaprovider:index:Configurer/meaningOfLife": {
      "inputs": {
        "properties": {
          "__self__": {
            "$ref": "#/resources/metaprovider:index:Configurer"
          }
        }
      },
      "outputs": {
        "type": "integer",
        "plain": true
      }
    },
    "metaprovider:index:Configurer/objectMix": {
      "inputs": {
        "properties": {
          "__self__": {
            "$ref": "#/resources/metaprovider:index:Configurer"
          }
        }
      },
      "outputs": {
        "type": "object",
        "plain": true,
        "properties": {
          "provider": {
            "$ref": "/tls/v4.10.0/schema.json#/provider"
          },
          "meaningOfLife": {
            "type": "integer"
          }
        }
      }
    }
  },
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 reviewing PR 13592 and its acceptance tests for the plain-valued method behavior across Node, Python, and Go, then compare that design with the Java implementation. Done means Java methods support plain singleton values, provider references, and mixed object results using the described schema forms.

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
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.