-
Notifications
You must be signed in to change notification settings - Fork 198
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
feat(sdk)!: add delete method for MutJson class #6236
Conversation
Thanks for opening this pull request! 🎉
|
meant as resolution for #5916 |
Signed-off-by: monada-bot[bot] <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
Signed-off-by: monada-bot[bot] <[email protected]>
Thanks for contributing, @partha04patel! This PR will now be added to the merge queue, or immediately merged if |
public delete(key: string): boolean { | ||
key; | ||
throw new Error("Macro"); | ||
} |
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.
What happens if delete()
is called on something that isn't a map? like Json true
or Json [1, 2, 3]
? Can we add tests for this?
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.
It should return true (matching the return comment).
null is also technically valid json and that would throw here (bad), but most of our json methods wouldn't correctly handle null anyways.
Agree a test would be good, my b for approving without more tests.
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.
I could try adding extra tests for some of those edge cases in another PR!
Congrats! 🚀 This was released in Wing 0.71.0. |
Checklist
pr/e2e-full
label if this feature requires end-to-end testingBy submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.
BREAKING CHANGE:
has()
removed from staticJson
. It is now an instance method onJson
objects.