-
Notifications
You must be signed in to change notification settings - Fork 31
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
Support invokes with non-object outputs, via wrapping #3165
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. New functions:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3165 +/- ##
==========================================
+ Coverage 55.04% 55.25% +0.21%
==========================================
Files 66 66
Lines 9857 9908 +51
==========================================
+ Hits 5426 5475 +49
+ Misses 4002 4001 -1
- Partials 429 432 +3 ☔ View full report in Codecov by Sentry. |
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.
Looks good overall - the reasoning looks solid and nicely factored commits 👍
One optional consideration around the growing list of magic bools
7bd61a9
to
fb1a6e2
Compare
If the schema has no properties but is a primitive output, we include it as a property so invokes can be generated. Ideally we'd just represent it as a primitive type and use FunctionSpec.ReturnType to specify this, but pulumi/pulumi 15739 and 15738 prevent this. Unfortunately, this required adding an unfortunate third boolean param to genProperties to limit this new case to function responses only.
Since commit 308846d requires the non-object responses to be wrapped in a certain object, ResourceCrudClient does that.
fb1a6e2
to
5c49672
Compare
func (m *moduleGenerator) genProperties(resolvedSchema *openapi.Schema, isOutput, isType, isResponse bool) (*propertyBag, error) { | ||
// genPropertiesVariant is a set of flags that control the behavior of property generation | ||
// in genProperties and genProperty | ||
type genPropertiesVariant struct { |
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 👍
Resolves #3147
If we're generating response properties and the resolved schema has no properties but is a primitive/array output, we include it as a special property so invokes can be generated.
Ideally we'd just represent the response as a primitive type without the wrapping magic property, using
FunctionSpec.ReturnType
, but pulumi/pulumi#15738 and pulumi/pulumi#15739 prevent this.Unfortunately, this change required adding a third boolean to
genProperties
to limit this new case to function responses only. Happy to incorporate suggestions to model this better.This is a simple program that demonstrates one of the new invokes.
Output: