-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[sdk/go] Add support for untagged outputs. #4640
Conversation
With these changes, a resource struct may tag a field with the empty string. If such a field is present, any resource outputs that were not unmarshalled into other fields will be unmarshalled into this field, which must be a `MapOutput`. Fixes #4629.
Another approach would be to add a |
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.
The approach looks sound.
WRT pulumi:""
vs a consistently available member on the result, I guess I'd just ask about frequency of use. This seems like an edge case, but do we imagine external consumers using this? As long as we document it clearly since it does kinda seem like "magic".
The major benefit would be that this might enable libraries to more conveniently deal with resources in a generic fashion. At the moment, a package that wants to observe the outputs of an arbitrary resource needs to use reflection to iterate over its fields. Taking the approach I described would allow packages to observe the outputs of an arbitrary Although I don't think that this is a common scenario, it would be nice to end up with one way to achieve this. If we take the approach implemented in this PR and add the suggested approach later, we'd end up with two similar but subtly different capabilities, and it might not be clear which to use when. |
Curious - what's an example of a case where someone would (or we have yet encountered a need ourselves to) add a "ID/URN-like metadata field"? |
|
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.
Confirmed that this worked for the k8s CustomResource.
@pgavlin Anything left to do here, or is this good to merge? |
This needs a CHANGELOG entry, but it's good to go other than that. |
With these changes, a resource struct may tag a field with the empty
string. If such a field is present, any resource outputs that were not
unmarshalled into other fields will be unmarshalled into this field,
which must be a
MapOutput
.Fixes #4629.