flipkart-incubator / zjsonpatch

This is an implementation of RFC 6902 JSON Patch written in Java
Apache License 2.0
523 stars 148 forks source link

Forbid remove missing flag #140

Closed luke-stead-sonocent closed 2 years ago

luke-stead-sonocent commented 2 years ago

When applying a remove operation, the target value must exist https://datatracker.ietf.org/doc/html/rfc6902#section-4.2.

This adds a compatibility flag which must be enabled to enforce this behaviour (to maintain compatibility by default with previous versions).

I've also fixed a couple of places where the JsonPatchApplicationException contained the wrong information.

holograph commented 2 years ago

LGTM, also love the fix, thanks! @vishwakarma I'm wondering if this shouldn't be the default behavior (breaking change + compatibility flag to regain "wrong" behavior), WDYT?

holograph commented 2 years ago

Ping @vishwakarma ?

vishwakarma commented 2 years ago

Thank you @luke-stead-sonocent Yes, @holograph looks good to me

luke-stead-sonocent commented 2 years ago

Thank you both!

If you do decide you want to change the behaviour so it defaults on, I'm happy to submit a PR. Just let me know. Would it also be possible to get a new release?

Thanks again!

vishwakarma commented 2 years ago

Sure We will do the new release by EOD tomorrow. I will update you here once the new version is released.

vishwakarma commented 2 years ago

Hi @luke-stead-sonocent I have released the new version 0.4.12,, should be in mvn central soon