Skip to content
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

Fix NodeJS metadata type #159

Merged
merged 3 commits into from
Nov 13, 2024
Merged

Fix NodeJS metadata type #159

merged 3 commits into from
Nov 13, 2024

Conversation

blampe
Copy link
Contributor

@blampe blampe commented Nov 12, 2024

All of our languages except NodeJS use SchemaPackageWithObjectMetaType. As a result, Node exposes only input types for object metadata which makes it awkward to consume downstream.

I'm assuming #143 didn't change this for backwards-compatibility reasons, or maybe it was overlooked. I think it is safe to continue generating the ObjectMeta type alias (in case users are importing it) but use the input/output types (matching the upstream k8s types) on resources.

Edit:

// schemaPackageWithObjectMetaType is the Pulumi schema package used to
// generate code for languages that need an ObjectMeta type (Python, Go, and .NET)

So this seems intentional. For whatever reason, using this with Node has the effect of generating input/output types matching upstream's types, which seems desirable.

Fixes #158

@blampe blampe requested a review from rquitales November 12, 2024 19:41
Comment on lines +277 to +278
assert.Contains(t, string(testResource), "public readonly metadata!: pulumi.Output<outputs.meta.v1.ObjectMeta>;", "expected metadata output type")
assert.Contains(t, string(testResource), "metadata?: pulumi.Input<inputs.meta.v1.ObjectMeta>;", "expected metadata input type")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were previously pulumi.Output<ObjectMeta> and pulumi.Input<ObjectMeta> respectively.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.98%. Comparing base (7a5693d) to head (c14b7f9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
- Coverage   78.56%   75.98%   -2.58%     
==========================================
  Files          17       17              
  Lines         723      966     +243     
==========================================
+ Hits          568      734     +166     
- Misses         87      163      +76     
- Partials       68       69       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@rquitales rquitales left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. #143 was trying to reduce the scope of changes to just the underlying implementation details, so not much thought was put towards this UX. The changes makes sense to me and I agree that it should be safe.

@blampe blampe merged commit d77b74b into master Nov 13, 2024
5 checks passed
@blampe blampe deleted the blampe/metadata branch November 13, 2024 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

input/output mismatch for nodejs ObjectMeta
2 participants