Open
Description
Description
If we denormalize some data structure with nested objects, the ExtraAttributesException
only provides extra attributes for the first full denormalized object (stops execution).
It would be nice to collect every extra attribute before throwing exception.
Something like when capturing PartialDenormalizationException
when DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS
is set to true.
Maybe related with #46283, we'll need paths for every extra attribute.
Example
class CategoryDto {
public string $name;
}
class ProductDto {
public string $name;
public Category $category;
}
{
"name": "Product name",
"extra1": "i'm not allowed",
"category": {
"name": "Category name",
"extra2": "i'm not allowed either"
}
}
If I deserialize this JSON into ProductDto
, it results in a ExtraAttributesException
, which is correct.
But, the ExtraAttributesException::getExtraAttributes()
returns the following:
array(1) {
[0]=>
string(5) "extra2"
}
Which is not correct: ProductDto
also has an extra attribute: extra1
.