[sdkgen/go] Array<Map<Map<Object>>> generates undefined nested input helper types
What happened?
Generating a Go SDK for a schema containing Array<Map<Map<Object>>>, where the leaf is a named object type, succeeds but produces Go code that does not compile.
The resource input references:
ScalingResourceMapMapArrayInputbut codegen instead emits a mismatched type named:
ScalingResourceArgsMapMapArrayInputThat generated type also references undefined ScalingResourceArgsMapMapInput and ScalingResourceArgsMapMapOutput types.
I expected Go SDK generation either to produce a consistent set of nested collection helper types or return a schema validation error. It should not report successful generation and then produce an uncompilable SDK.
Example
Save this as schema.json:
{
"name": "repro",
"version": "0.1.0",
"resources": {
"repro:index:Foo": {
"inputProperties": {
"scalingResources": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"$ref": "#/types/repro:index:ScalingResource"
}
}
}
}
},
"properties": {
"scalingResources": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"$ref": "#/types/repro:index:ScalingResource"
}
}
}
}
}
}
},
"types": {
"repro:index:ScalingResource": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": ["name"]
}
},
"language": {
"go": {
"importBasePath": "example.com/repro/sdk/go/repro"
}
}
}Generate and compile the SDK:
mkdir sdk
pulumi package gen-sdk schema.json \
--language go \
--out sdk \
--version 0.1.0
cd sdk/go
go mod init example.com/repro/sdk/go
go mod edit -require=github.com/pulumi/pulumi/sdk/[email protected]
go mod tidy
go build ./...The build fails with:
# example.com/repro/sdk/go/repro
repro/foo.go:65:19: undefined: ScalingResourceMapMapArrayInput
repro/pulumiTypes.go:110:39: undefined: ScalingResourceArgsMapMapInput
repro/pulumiTypes.go:149:72: undefined: ScalingResourceArgsMapMapOutput
repro/pulumiTypes.go:152:6: undefined: ScalingResourceArgsMapMapOutputOutput of pulumi about
This reproducer generates an SDK directly rather than running a Pulumi project, so pulumi about is not applicable.
Pulumi CLI: v3.253.0
Go: go1.25.11 darwin/arm64
OS: Darwin arm64Additional context
This was encountered in pulumi-aws-native for the ARC Region Switch PlanEksResourceScalingConfiguration.scalingResources property. AWS Native currently has to represent this collection as Any to keep its generated Go SDK compilable.
Nested primitive collections now compile, including three-level primitive combinations added by #21248. The remaining failure appears specific to nested collections whose leaf is a named object type.
This resembles the invalid Args collection helper names previously reported in #7595 and fixed by #7779, but the Array<Map<Map<Object>>> shape still triggers the mismatch in current codegen.
Related: #15478.
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 have opened one.
Source: pulumi/pulumi