Map values generated as String instead of Input<String>
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
What happened?
I added a resource to schema.json with the following input property:
"additionalEnvironment": {
"type": "object",
"additionalProperties": {
"type": "string",
"plain": false
},
"plain": true
}
In other words the key of the map should be a String and the value should be Input.
Instead the java code builder method for this property is generated as follows:
public Builder additionalEnvironment(@Nullable Map<String,String> additionalEnvironment) {
$.additionalEnvironment = additionalEnvironment;
return this;
}
Do note that the corresponding Python code is correctly generated as follows:
@additional_environment.setter
def additional_environment(self, value: Optional[Mapping[str, pulumi.Input[str]]]):
pulumi.set(self, "additional_environment", value)
Expected Behavior
The java code should be generated as follows:
public Builder additionalEnvironment(@Nullable Map<String,Input<String>> additionalEnvironment) {
$.additionalEnvironment = additionalEnvironment;
return this;
}
Steps to reproduce
Clone the repo https://github.com/hansbarnard/pulumi-test-java.
From within the top level directory execute make build_java.
Check the file at sdk/java/src/main/java/com/xxxxx/ipidp/awsecsservice/service/EcsServiceArgs.java for the incorrectly generated code.
Output of pulumi about
Not applicable.
Additional context
Using java gen version v0.9.3.
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running make build_java in the linked reproduction repository and inspect sdk/java/src/main/java/com/xxxxx/ipidp/awsecsservice/service/EcsServiceArgs.java. Trace the Java generator's handling of the additionalEnvironment object in schema.json, comparing it with the correctly generated Python type. Done means the Java builder uses Map<String, Input<String>> for this property.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100