Tread entities nested in arrays like PUT for merge patch requests.

Fixes GH-2358.
This commit is contained in:
Oliver Drotbohm
2024-01-19 18:22:22 +01:00
parent 6cec482bb4
commit 41de5ad983
2 changed files with 5 additions and 4 deletions

View File

@@ -402,7 +402,7 @@ public class DomainObjectReader {
if (ObjectNode.class.isInstance(jsonNode)) {
nestedObjectFound = true;
doMerge((ObjectNode) jsonNode, next, mapper);
readPut((ObjectNode) jsonNode, next, mapper);
}
}

View File

@@ -237,8 +237,9 @@ class DomainObjectReaderUnitTests {
assertThat(reader.readPut(node, sample, mapper).createdDate).isEqualTo(reference);
}
@Test // DATAREST-931
void readsPatchForEntityNestedInCollection() throws Exception {
@Test // DATAREST-931, GH-2358
// https://datatracker.ietf.org/doc/html/rfc7386#section-2
void handlesEntityNestedInAnArrayLikePutForPatchRequest() throws Exception {
Phone phone = new Phone();
phone.creationDate = new GregorianCalendar();
@@ -251,7 +252,7 @@ class DomainObjectReaderUnitTests {
User result = reader.read(source, user, new ObjectMapper());
assertThat(result.phones.get(0).creationDate).isNotNull();
assertThat(result.phones.get(0).creationDate).isNull();
}
@Test // DATAREST-919