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

[schema] Emit a warning when using id or urn as resource properties #15060

Merged
merged 1 commit into from Jan 18, 2024

Conversation

Zaid-Ajaj
Copy link
Contributor

Description

Emits a warning when binding properties of resources if we encounter a property with name urn or when we encounter a property with name id (only for resources which are not components / MLCs). This is a follow up PR for #15025

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@Zaid-Ajaj Zaid-Ajaj requested a review from a team January 5, 2024 02:26
@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jan 5, 2024

Changelog

[uncommitted] (2024-01-17)

Miscellaneous

  • [sdkgen] Emit a warning when using id or urn as resource outputs
    #15060

Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

Is there an easy way to test the warnings?

LGTM otherwise.

Copy link
Member

@Frassle Frassle left a comment

Choose a reason for hiding this comment

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

Yeh this needs to re-add the tests removed in #15025.

Unfortunately because ImportSpec only returns errors not diagnostics you'll need to call bindSpec in the test instead.

@Frassle
Copy link
Member

Frassle commented Jan 5, 2024

Also a new test to check that for a component resource urn still warns but id doesn't.

@Zaid-Ajaj Zaid-Ajaj force-pushed the zaid/emit-warning-for-id-and-urn branch from 6573f85 to 79d96f0 Compare January 5, 2024 15:20
@Zaid-Ajaj
Copy link
Contributor Author

@Frassle @justinvp added tests for both cases ✅

pkg/codegen/schema/bind.go Show resolved Hide resolved
@Zaid-Ajaj Zaid-Ajaj added this pull request to the merge queue Jan 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 17, 2024
@Zaid-Ajaj Zaid-Ajaj added this pull request to the merge queue Jan 18, 2024
Merged via the queue into master with commit 7e9aab2 Jan 18, 2024
53 checks passed
@Zaid-Ajaj Zaid-Ajaj deleted the zaid/emit-warning-for-id-and-urn branch January 18, 2024 01:35
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
### Features

- [sdk/go] Add WithValue to pulumi.Context
  [#15149](#15149)


### Bug Fixes

- [cli] Fix a panic when user's home directory could not be looked up.
  [#15160](#15160)

- [cli/display] Fix JSON/YAML value diff displays.

- [sdk/go] Update github.com/cloudflare/circl to v1.3.7.
  [#15151](#15151)

- [cli/import] --import-file now omits empty resource lists.
  [#15132](#15132)

- [sdk/python] Allow remote components to use output property called id


### Miscellaneous

- [sdkgen] Emit a warning when using id or urn as resource outputs
  [#15060](#15060)
@justinvp justinvp mentioned this pull request Jan 18, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jan 18, 2024
### Features

- [sdk/go] Add WithValue to pulumi.Context
  [#15149](#15149)


### Bug Fixes

- [cli] Fix a panic when user's home directory could not be looked up.
  [#15160](#15160)

- [cli/display] Fix JSON/YAML value diff displays.
  [#15171](#15171)

- [sdk/go] Update github.com/cloudflare/circl to v1.3.7.
  [#15151](#15151)

- [cli/import] --import-file now omits empty resource lists.
  [#15132](#15132)

- [sdk/python] Allow remote components to use output property called id
  [#15115](#15115)


### Miscellaneous

- [sdkgen] Emit a warning when using id or urn as resource outputs
  [#15060](#15060)
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.

None yet

4 participants