Problem
The Go polyglot generator currently nests an optional DTO parameter inside the generated method-options wrapper when the C# API has an optional parameter named options.
For example, the Foundry hosted-agent API currently generates a Go call shape like:
hostedAgent.AsHostedAgent(project, &aspire.AsHostedAgentOptions{
Options: &aspire.HostedAgentOptions{
Description: "Validation hosted agent",
Cpu: aspire.Float64Ptr(1),
Memory: aspire.Float64Ptr(2),
},
})
This is awkward because there are two different options concepts:
AsHostedAgentOptions: the generated Go wrapper for optional method parameters
HostedAgentOptions: the DTO that represents the actual API options payload
TypeScript already flattens this scenario into the user-facing DTO shape:
await hostedAgent.asHostedAgent(project, {
description: "Validation hosted agent",
cpu: 1,
memory: 2
});
Expected behavior
The Go generator should apply equivalent flattening for optional DTO parameters so Go callers do not have to write Options: &HostedAgentOptions{ ... } when the optional parameter is itself the exported DTO/options payload.
Notes
This came up while updating the Foundry hosted-agent polyglot fixtures in PR #17545. That PR keeps the generated Go shape as-is and should not take the generator fix.
Problem
The Go polyglot generator currently nests an optional DTO parameter inside the generated method-options wrapper when the C# API has an optional parameter named
options.For example, the Foundry hosted-agent API currently generates a Go call shape like:
This is awkward because there are two different options concepts:
AsHostedAgentOptions: the generated Go wrapper for optional method parametersHostedAgentOptions: the DTO that represents the actual API options payloadTypeScript already flattens this scenario into the user-facing DTO shape:
Expected behavior
The Go generator should apply equivalent flattening for optional DTO parameters so Go callers do not have to write
Options: &HostedAgentOptions{ ... }when the optional parameter is itself the exported DTO/options payload.Notes
This came up while updating the Foundry hosted-agent polyglot fixtures in PR #17545. That PR keeps the generated Go shape as-is and should not take the generator fix.