pulumi icon indicating copy to clipboard operation
pulumi copied to clipboard

Resolve discriminated unions when the discriminator is a string pointer

Open thomas11 opened this issue 3 years ago • 3 comments

Examples in our docs that use discriminated unions to determine ...Input types are broken, e.g., pulumi/pulumi-azure-native#1960.

Debugging this, I found that the discriminator is expected to be a string, but it is (in this case) a *string wrapped in a __convert call. This patch simply tries both cases.

Submitting this as a speculative draft PR because I'm new to this area and don't know if this is the best approach to fix the issue. Maybe the __convert(*string) should be resolved to a plain string before the lookup?

Apologies for the whitespace changes, gofmt 1.19 will do that.

thomas11 avatar Sep 14 '22 04:09 thomas11

Please view the results of the Downstream Codegen Tests Here

pulumi-bot avatar Sep 14 '22 04:09 pulumi-bot

Changelog

[uncommitted] (2022-09-22)

pulumi-bot avatar Sep 14 '22 04:09 pulumi-bot

I see a .NET test case. We're missing a test case for python, nodejs and go. If the test case tests your code, I can take it from there if you want?

iwahbe avatar Sep 20 '22 14:09 iwahbe

bors merge

thomas11 avatar Sep 23 '22 03:09 thomas11

Build succeeded:

bors[bot] avatar Sep 23 '22 03:09 bors[bot]