Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Bean Validation: Composition request with failing parent entity hides additional errors from child entity #45

Closed
mariodavid opened this issue Mar 3, 2021 · 1 comment
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@mariodavid
Copy link
Contributor

Given the following request:

POST {{baseUrl}}
         /entities
         /rstex11_Order?responseFetchPlan=order-with-details
Authorization: Bearer {{auth_token}}

{
  "customer": null,
  "date": "2021-03-01",
  "amount": 130.08,
  "lines": [
    {
      "product": null,
      "quantity": 2
    }
  ]
}

With "product": null in the child entity and customer: null in the parent entity, it only shows the error of the parent entity

[
  {
    "message": "may not be null",
    "messageTemplate": "{javax.validation.constraints.NotNull.message}",
    "path": "customer",
    "invalidValue": null
  }
]

Expected behavior:

[
  {
    "message": "may not be null",
    "messageTemplate": "{javax.validation.constraints.NotNull.message}",
    "path": "customer",
    "invalidValue": null
  },
  {
    "message": "may not be null",
    "messageTemplate": "{javax.validation.constraints.NotNull.message}",
    "path": "lines[0].product",
    "invalidValue": null
  }
]

so that the client can see all error of the complete entity graph at once.

@knstvk knstvk added the type: bug Something isn't working label Mar 4, 2021
@knstvk knstvk removed the type: bug Something isn't working label Mar 18, 2021
@gorbunkov gorbunkov added the type: bug Something isn't working label Aug 18, 2021
@gorbunkov gorbunkov added this to the 1.1.0 milestone Aug 18, 2021
@Desire456
Copy link
Contributor

Hi @mariodavid,

To achieve that just mark the list of lines as @Valid.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants