New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[codegen/go] Support foreign enum types #9920
Conversation
Please view the results of the Downstream Codegen Tests Here |
Please view the results of the Downstream Codegen Tests Here |
switch t := t.(type) { | ||
case *schema.OptionalType: | ||
pkg.getTypeImports(t.ElementType, recurse, importsAndAliases, seen) | ||
case *schema.InputType: | ||
pkg.getTypeImports(t.ElementType, recurse, importsAndAliases, seen) | ||
case *schema.EnumType: | ||
if importExternal(t.Token) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the line immediately below it try to handle externals also?
mod := pkg.tokenToPackage(t.Token)
if mod != pkg.mod // here
I wonder if that is now redundant (dead code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be. Notice that we are comparing mod
instead of pkg
. This is us handling enums from other modules (but the same pkg). When we check for external, we compare via pkg
:
Lines 607 to 608 in 35461be
case *schema.EnumType: | |
isExternal = pkg.pkg != nil && typ.Package != pkg.pkg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks.
TypeLocalInsteadOfRemoteAlias gcpiamv1.AuditConfig `pulumi:"typeLocalInsteadOfRemoteAlias"` | ||
TypeNoAlias s3.BucketWebsite `pulumi:"typeNoAlias"` | ||
TypeRemoteAlias dns.DnsKeySpec `pulumi:"typeRemoteAlias"` | ||
TypeRemoteEnum *accesscontextmanager.DevicePolicyAllowedDeviceManagementLevelsItem `pulumi:"typeRemoteEnum"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Description
Fixes #9916
Checklist