From 6ec12287267d873e4d188fc121e9c7df37411097 Mon Sep 17 00:00:00 2001 From: Edik Amperyan Date: Mon, 5 Aug 2024 04:53:50 +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 e7d1f1683..f8a50a652 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 @@ -71,7 +71,6 @@ private String verify(String pointer, Class type, BiFunction return pointer; } - PropertyPath base = null; StringBuilder result = new StringBuilder(); TypeInformation currentType = ClassTypeInformation.from(type); @@ -105,13 +104,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); }