spring-projects / spring-projects/spring-data-rest

ValidationErrors unable to resolve nested properties. [DATAREST-496]

Open
#872 3 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

status: feedback-provided type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Andrew Hamilton opened DATAREST-496 and commented

org.springframework.data.rest.core.ValidationErrors#getFieldValue uses the field as a key into the propertyCache when attempting to resolve the invalid value of the validation error.

For nested properties, this always results in a null invalidValue:

{
  "errors" : [ {
    "entity" : "PurchaseOrder",
    "message" : "must match \"((0[0-9])|(1[0-2])|(2[1-9])|(3[0-2])|(6[1-9])|(7[0-2])|80)([0-9]{7})\"",
    "invalidValue" : "null",
    "property" : "payment.bankAccount.routingNumber"
  } ]
}

For this request the routingNumber was "02100002133222".

From a quick look at the code, I'm not sure if getFieldValue should do the property navigation to attempt to find the invalid value, or if there's a more appropriate place to do that


Affects: 2.2.1 (Evans SR1)

1 votes, 4 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.