pulumi/pkg/codegen/testing/test/testdata/unions-inside-arrays/dotnet
Zaid Ajaj 59c3de65a2
[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679)
# Description

When using types in union cases (using `oneOf` in the schema) then Go
SDK-gen doesn't detect these types as being used as inputs and only
emits the plain version of a type. That is unless
`generateExtraInputTypes: true` is specified in which case Go SDK-gen
will emit the non-plain types as well.

In the case of azure-native modules, `generateExtraInputTypes` is
currently set to `false` (default) as of latest v2.19.0 and is missing a
few non-plain type variants (for example
`FirewallPolicyFilterRuleCollection` from [this
file](https://raw.githubusercontent.com/pulumi/pulumi-azure-native-sdk/master/network/pulumiTypes.go)).
There no single plain type in azure-native and yet it is missing these
non-plain variants.

This PR fixes that by also traversing the element types of schema union
definitions when determining plain-ness of types and how they are used.

I added an example schema with an array of unions (common case in
azure-native) and confirmed that the change actually results in the
non-plain types being generated when `generateExtraInputTypes` is set to
`false`

Fixes https://github.com/pulumi/pulumi-azure-native/issues/1922 

## Checklist

- [ ] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [x] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-11-29 12:37:53 +00:00
..
Inputs [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
ExampleServer.cs [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
Provider.cs [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
Pulumi.Example.csproj [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
README.md [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
Utilities.cs [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
codegen-manifest.json [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
logo.png [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
pulumi-plugin.json [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00
version.txt [sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions (#14679) 2023-11-29 12:37:53 +00:00

README.md