From 70e1ba970a2b0d5865a08e95c6befaa33bfc9239 Mon Sep 17 00:00:00 2001 From: Gene Gleyzer Date: Tue, 15 Oct 2024 09:55:35 -0400 Subject: [PATCH] Post review changes --- lib_json/src/main/x/json/JsonMergePatch.x | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_json/src/main/x/json/JsonMergePatch.x b/lib_json/src/main/x/json/JsonMergePatch.x index bd0fbbeb9..3e14c52cd 100644 --- a/lib_json/src/main/x/json/JsonMergePatch.x +++ b/lib_json/src/main/x/json/JsonMergePatch.x @@ -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) { @@ -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)); } } } @@ -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