Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Wrong Serializer Groups import in Symfony User documentation

Open Beginner friendly
#8,573 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
85/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
php, symfony
Domain
documentation

Research direction

Find the User documentation file in the repository (likely in docs/core/user-guide/ or similar). Locate the import statement for Groups. Change 'Annotation\Groups' to 'Attribute\Groups'. Verify the change by checking if the documentation builds correctly, and ensure no other related imports need updating.

Written by the indexing model from the issue text.

Description

The Symfony User documentation uses the following import for serialization groups:

use Symfony\Component\Serializer\Annotation\Groups;

With API Platform 5.0 and Symfony 8.1, this does not work as shown in the documentation.

The correct import is:

use Symfony\Component\Serializer\Attribute\Groups;

I noticed this because debug:serializer App\Entity\User showed empty serialization groups for all properties when using Annotation\Groups.

After changing the import to Attribute\Groups and clearing the Symfony cache, the serialization groups were correctly detected and the documented user creation endpoint worked as expected.

Environment
API Platform: 5.0
Symfony: 8.1
PHP: 8.4
Expected behavior

The serialization groups shown in the documentation should be recognized when following the example with a current Symfony version.

Actual behavior

Using Symfony\Component\Serializer\Annotation\Groups results in the groups not being recognized by the serializer.

debug:serializer App\Entity\User reports:

email groups => []
plainPassword groups => []

This subsequently causes the documented POST /api/users operation to fail validation because email and plainPassword are not denormalized.

Suggested fix

Update the example to use:

use Symfony\Component\Serializer\Attribute\Groups;

The current serialization documentation already indicates that Symfony 7+ uses attributes, so the User documentation appears to be inconsistent with this.

Dominant language
PHP
Stars
2.6k
Forks
982
Avg merge
1d 19h
Merged PRs (30d)
67

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from api-platform/core

All issues in api-platform/core

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.