[sdk-gen/go] Generate non-plain type variants for types used as inputs inside unions #14679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 unlessgenerateExtraInputTypes: 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 tofalse
(default) as of latest v2.19.0 and is missing a few non-plain type variants (for exampleFirewallPolicyFilterRuleCollection
from this file). 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 tofalse
Fixes pulumi/pulumi-azure-native#1922
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change