Skip to content

docs: fix Serializer\Annotation import removed in Symfony 8.0 - #2348

Open
soyuka wants to merge 1 commit into
api-platform:4.4from
soyuka:fix/serializer-groups-attribute-import
Open

soyuka wants to merge 1 commit into
api-platform:4.4from
soyuka:fix/serializer-groups-attribute-import

Conversation

@soyuka

@soyuka soyuka commented Sep 28, 2026

Copy link
Copy Markdown
Member

Fixes api-platform/core#8573.

The docs tell readers to import serializer attributes from Symfony\Component\Serializer\Annotation\. Those class aliases were deprecated in Symfony 7.4 and removed in 8.0, so on a current Symfony the import is a class-not-found and the attribute never applies.

The reporter hit it concretely: with the old import, debug:serializer App\Entity\User shows groups => [] for every property, so the documented POST /api/users flow fails validation because email and plainPassword are never denormalized.

Verified against an installed symfony/serializer 8.1.6: there is no Annotation/ directory at all, only Attribute/.

21 replacements across 6 files, every one a single import line:

file replacements
core/serialization.md 12 (9 Groups, 3 Context)
core/graphql.md 4
symfony/file-upload.md 2
symfony/controllers.md 1
symfony/fosuser-bundle.md 1
symfony/user.md 1

Context is included because the whole alias namespace went together; Groups and Context are the only two classes from it that these docs reference. No prose was changed.

markdownlint-cli2 is clean on all six files.

Symfony 8.0 removed the Annotation namespace class aliases (deprecated
since 7.4); Groups and Context now live under Serializer\Attribute.
The old import silently drops all groups (debug:serializer shows
groups => []), breaking every documented denormalization example.

Refs api-platform/core#8573

This branch has not been deployed

No deployments
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