Uh oh!
There was an error while loading. Please reload this page.
Added getters for JsonPatch and Operations - #79
Conversation
Spellmaker
commented
Jul 24, 2020
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) |
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 As far as this PR, it seems innocuous as |
Uh oh!
There was an error while loading. Please reload this page.
| throws JsonPatchException; | ||
| public String getOp() { | ||
| return op; |
There was a problem hiding this comment.
Should this protectively copy the string?
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?
Uh oh!
There was an error while loading. Please reload this page.
GavinF17
commented
Aug 5, 2020
Thanks for the feedback, addressed all comments with one outstanding |
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(). |
ceenlrnjim
commented
Oct 14, 2021
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? |

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