Skip to content

fix(serializer): translate PropertyAccess type mismatches to NotNormalizableValueException#7967

Merged
soyuka merged 2 commits into
api-platform:4.3from
soyuka:fix/null-on-non-nullable
May 12, 2026
Merged

fix(serializer): translate PropertyAccess type mismatches to NotNormalizableValueException#7967
soyuka merged 2 commits into
api-platform:4.3from
soyuka:fix/null-on-non-nullable

Conversation

@soyuka
Copy link
Copy Markdown
Member

@soyuka soyuka commented May 11, 2026

Q A
Branch? 4.3
Tickets symfony/symfony#64159
License MIT
Doc PR

AbstractItemNormalizer::setAttributeValue() now catches PropertyAccess\InvalidArgumentException and rethrows as NotNormalizableValueException, mirroring the contract ObjectNormalizer implements per symfony/symfony#64067. Without this, null on a non-nullable typed property bubbled up as HTTP 500 instead of a 4xx denormalization error.

…lizableValueException

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Tickets       | symfony/symfony#64159
| License       | MIT
| Doc PR        | ∅

AbstractItemNormalizer::setAttributeValue() now catches PropertyAccess\InvalidArgumentException
and rethrows as NotNormalizableValueException, mirroring the contract ObjectNormalizer implements
per symfony/symfony#64067. Without this, null on a non-nullable typed property bubbled up as
HTTP 500 instead of a 4xx denormalization error.
@soyuka soyuka force-pushed the fix/null-on-non-nullable branch from af10f1e to e2467a8 Compare May 11, 2026 13:18
…ibuteValue contract

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Tickets       | symfony/symfony#64067
| License       | MIT
| Doc PR        | ∅

The COLLECT_DENORMALIZATION_ERRORS aggregation in AbstractObjectNormalizer was reworked in
symfony/symfony#64067 (released in 6.4.37 / 7.4.9 / 8.0.9). Now that AbstractItemNormalizer
implements that contract, older Symfony parents would no longer aggregate our translated
exceptions and would respond with 400 instead of 422.
@soyuka soyuka changed the base branch from main to 4.3 May 12, 2026 10:07
@soyuka soyuka merged commit 412682e into api-platform:4.3 May 12, 2026
116 of 120 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant