Skip to content

Commit

Permalink
Post review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gene Gleyzer committed Oct 23, 2024
1 parent e90220f commit 70e1ba9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib_json/src/main/x/json/JsonMergePatch.x
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class JsonMergePatch(Doc patch) {
* @return the JSON value resulting from applying this patch to the target
*/
Doc apply(Doc target, Boolean inPlace = False) {
return merge(target, patch);
return merge(target, patch, inPlace);
}

private Doc merge(Doc doc, Doc patch, Boolean inPlace = False) {
Expand All @@ -50,7 +50,8 @@ class JsonMergePatch(Doc patch) {
if (Doc targetValue := target.get(key)) {
merge(key, merge(targetValue, value, inPlace));
} else {
merge(key, merge(json.newObject(), value, True)); // TODO JK: why not "inPlace"
// merging the value into a new JsonObject (hence inPlace is `True`)
merge(key, merge(json.newObject(), value, True));
}
}
}
Expand All @@ -72,7 +73,7 @@ class JsonMergePatch(Doc patch) {
}

/**
* Generate a JSON Merge Patch from the source and target {@code JsonValue}.
* Generate a JSON Merge Patch from the source and target `JsonValue`.
*
* @param source the source
* @param target the target
Expand Down

0 comments on commit 70e1ba9

Please sign in to comment.