From 4da9ee5071fee85fd19396e2e8d6a340e767e262 Mon Sep 17 00:00:00 2001 From: Edik Amperyan Date: Mon, 5 Aug 2024 04:51:43 +0300 Subject: [PATCH] Fix updating nested collection fields using JSON Patch Fix updating nested collection fields using JSON Patch Closes #2401 Related tickets #2401 --- .../data/rest/webmvc/json/patch/JsonPointerMapping.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/JsonPointerMapping.java b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/JsonPointerMapping.java index e81cb3bdd..63b58221f 100644 --- a/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/JsonPointerMapping.java +++ b/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/json/patch/JsonPointerMapping.java @@ -74,7 +74,6 @@ private String verify(String pointer, Class type, BiFunction return pointer; } - PropertyPath base = null; StringBuilder result = new StringBuilder(); TypeInformation currentType = ClassTypeInformation.from(type); @@ -108,13 +107,11 @@ private String verify(String pointer, Class type, BiFunction .orElseThrow(() -> reject(segment, rejectType, pointer, qualifier)); try { - base = base == null ? PropertyPath.from(property, type) : base.nested(segment); + currentType = PropertyPath.from(property, currentType).getTypeInformation(); } catch (PropertyReferenceException o_O) { throw reject(segment, rejectType, pointer, qualifier); } - currentType = base.getTypeInformation(); - result.append("/").append(property); }