Skip to content

feat(serializer)!: normalize collected outputs in a single pass - #8943

Open
soyuka wants to merge 2 commits into
output-resource/4-mapper-writesfrom
output-resource/5-anonymous-paths
Open

soyuka wants to merge 2 commits into
output-resource/4-mapper-writesfrom
output-resource/5-anonymous-paths

Conversation

@soyuka

@soyuka soyuka commented Dec 3, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? main (6.0, merge after v5.1.0)
Tickets Refs #8849
License MIT
Doc PR api-platform/docs#2321 (to rewrite once the stack lands)

Part 5/6 of the RFC #8849 stack (https://github.com/api-platform/core/stack/8945), review commit by commit: the first commit is the failing test.

A collected output is normalized in the same pass instead of going through the serializer a second time with a rewritten context. Interface outputs (not collected) keep the old path. The api_resource context key was never set anymore: its branches and the constructor arguments they used are removed from the HAL, JSON:API and GraphQL ObjectNormalizer.

Test: src/Serializer/Tests/ItemNormalizerTest.php::testOutputIsNormalizedWithoutReenteringTheSerializer.

Not done here: the input side still re-dispatches (it wraps errors as "The input data is misformatted.", needs its own change).

BC: ObjectNormalizer constructors of HAL, JSON:API and GraphQL changed.

A collected output class is normalized in place, without going through
the serializer a second time. Interface outputs, which are not
collected, keep the previous behaviour. The api_resource context key was
never set anymore: its branches and the arguments they used are removed
from the HAL, JSON:API and GraphQL object normalizers.

Refs #8849
@soyuka
soyuka added this pull request to stack #8945 December 3, 2026 15:14
@soyuka soyuka changed the title output resource/5 anonymous paths feat(serializer)!: normalize collected outputs in a single pass Dec 3, 2026
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