| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I'm also highly interested in this PR getting merged, getters would be really useful for examining the operations (in my use-case: checking for certain paths to discourage changes to some part of the json document) |
Sorry, something went wrong.
|
My use case is similar to @Spellmaker but notably different. We have JSON models that map to database models where only some fields are mutable via our REST API. We need to be able to examine a patch request in order to validate that the JSON paths are mutable according to business policy. While we could do this with raw JSON and then parse it into a JsonPatch object after validation, it would be far more convenient to work with the parsed version where the operation and path are easily accessible on a JsonPatch object. As far as this PR, it seems innocuous as operations is final and wrapped in an immutable collection, so there's no risk of clients mutating the internal state by exposing it via a getter. I hope you'll consider this enhancement. |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good overall.
Sorry, something went wrong.
| throws JsonPatchException; | ||
|
|
||
| public String getOp() { | ||
| return op; |
There was a problem hiding this comment.
Should this protectively copy the string?
Sorry, something went wrong.
There was a problem hiding this comment.
I wouldn't have thought this is necessary as String is immutable, if I'm not thinking of something can you please explain?
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, you're right.
Sorry, something went wrong.
Thanks for the feedback, addressed all comments with one outstanding |
Sorry, something went wrong.
|
I am using v.13 (https://mvnrepository.com/artifact/com.github.java-json-tools/json-patch/1.13), but still not able to use method getOperations(). |
Sorry, something went wrong.
|
We are also interested in having the getOperations accessor and see that it isn't in 1.13 - are there plans for another release that will pick up this change? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Hoping this gets picked up & released due to recent activity by @Capstan :)
Personal use case is needing to determine which class to patch when using subtypes, and the type info being held in a field which may be modified by a replace operation.
Solves #33
Supercedes #45