-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
Description
Description
Using collectDenormalizationErrors
key converts deserialization exceptions to validation violations. But sometimes, some deserialization exceptions are not catched, which cause an HTTP 400 far before the validation process. It leads to an incomplete response without all the violations.
Example
Request:
POST /bookmarks
Content-Type: application/ld+json
Accept: application/ld+json
{
"book": "/book/uuid-of-a-non-existing-book",
"bookmarkedAt": ""
}
400 HTTP Response:
{
"@context": "/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "Item not found for \"/books/uuid-of-a-non-existing-book\".",
}
Expected response
HTTP 422
{
"@context": "/contexts/Error",
"@type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "book: Item not found for \"/books/uuid-of-a-non-existing-book\".\nbookmarkedAt: This value should not be blank.",
"violations": [
{
"propertyPath": "book",
"hint": "Item not found for \"/books/uuid-of-a-non-existing-book\"."
},
{
"propertyPath": "bookmarkedAt",
"hint": "This value should not be blank."
}
]
}
jamesisaac and dannypritchardevident