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

feat(sdk)!: add delete method for MutJson class #6236

Merged
merged 11 commits into from
Apr 18, 2024

Conversation

partha04patel
Copy link
Contributor

@partha04patel partha04patel commented Apr 14, 2024

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By 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 static Json. It is now an instance method on Json objects.

@partha04patel partha04patel requested a review from a team as a code owner April 14, 2024 18:13
@partha04patel partha04patel changed the title feat(wingsdk): add delete method for MutJson class feat(sdk): add delete method for MutJson class Apr 14, 2024
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@partha04patel
Copy link
Contributor Author

meant as resolution for #5916

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 14, 2024
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 14, 2024
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 15, 2024
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 15, 2024
@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 16, 2024
@MarkMcCulloh MarkMcCulloh changed the title feat(sdk): add delete method for MutJson class feat(sdk)!: add delete method for MutJson class Apr 18, 2024
@MarkMcCulloh MarkMcCulloh removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Apr 18, 2024
Copy link
Contributor

mergify bot commented Apr 18, 2024

Thanks for contributing, @partha04patel! This PR will now be added to the merge queue, or immediately merged if main is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Apr 18, 2024
@mergify mergify bot merged commit 24178a4 into winglang:main Apr 18, 2024
15 checks passed
Comment on lines +462 to +465
public delete(key: string): boolean {
key;
throw new Error("Macro");
}
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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!

@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.71.0.

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.

5 participants