Skip to content

fix(serializer): report all missing constructor arguments in instantiateObject#7805

Merged
soyuka merged 3 commits intoapi-platform:4.2from
soyuka:fix/7785
Feb 27, 2026
Merged

fix(serializer): report all missing constructor arguments in instantiateObject#7805
soyuka merged 3 commits intoapi-platform:4.2from
soyuka:fix/7785

Conversation

@soyuka
Copy link
Member

@soyuka soyuka commented Feb 27, 2026

Q A
Branch? 4.2
Tickets Fixes #7794 and #7785
License MIT
Doc PR

…ateObject

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Tickets       | Fixes api-platform#7785
| License       | MIT
| Doc PR        | ∅

* Add missing `continue` after collecting a missing constructor argument
  name, matching Symfony's AbstractNormalizer::instantiateObject() behavior.
* Without it, the first missing arg initializes `not_normalizable_value_exceptions`
  in context, causing subsequent missing args to skip the collection — only the
  first missing field was reported in MissingConstructorArgumentsException.
* Also set `api_platform_input` context flag when re-entering the serializer
  for input DTO denormalization, so downstream normalizers can detect re-entry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@soyuka soyuka force-pushed the fix/7785 branch 3 times, most recently from 9e8cc6c to 9d02040 Compare February 27, 2026 15:14
… DTOs

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Tickets       | Fixes api-platform#7794
| License       | MIT
| Doc PR        | ∅

* When re-entering the serializer for input DTO denormalization, the data
  has already been unwrapped from the JSON:API `data.attributes` structure.
* Without this guard, JsonApi\ItemNormalizer::denormalize() runs a second
  time on flat data, reads `$data['data']['attributes']` → null, and nulls
  every DTO property.
* Skip JSON:API extraction when `api_platform_input` context flag is set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@soyuka soyuka merged commit 8c75fda into api-platform:4.2 Feb 27, 2026
147 of 148 checks passed
@soyuka soyuka deleted the fix/7785 branch February 27, 2026 16:03
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