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

privatestate: Support nil or zero-length value in SetKey to remove key #911

Merged
merged 2 commits into from
Jan 26, 2024

Conversation

bflad
Copy link
Member

@bflad bflad commented Jan 26, 2024

Closes #910

This change ensures that developers can fully remove private state keys by setting the value to nil or []byte{}. Attempting to set the value to either value would previously generate an error. The closest available workaround was to set keys to the literal JSON null and handle that value during unmarshaling, rather than purely checking existence via GetKey() returning nil.

Reference: #910

This change ensures that developers can fully remove private state keys by setting the value to `nil` or `[]byte{}`. Attempting to set the value to either value would previously generate an error. The closest available workaround was to set keys to the literal JSON `null` and handle that value during unmarshaling, rather than purely checking existence via `GetKey()` returning `nil`.
@bflad bflad added the enhancement New feature or request label Jan 26, 2024
@bflad bflad added this to the v1.6.0 milestone Jan 26, 2024
@bflad bflad requested a review from a team as a code owner January 26, 2024 12:40
Copy link
Contributor

@bendbennett bendbennett left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@bflad bflad merged commit 57bed28 into main Jan 26, 2024
27 checks passed
@bflad bflad deleted the bflad/ProviderData-SetKey-nil branch January 26, 2024 16:17
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Allow removing key from Private data
2 participants