Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Wrong Serializer Groups import in Symfony User documentation

オープン 初心者向け
#8,573 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
85/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php, symfony
領域
documentation

調査の方向性

リポジトリ内のユーザードキュメントファイルを見つけます(おそらく docs/core/user-guide/ などにあります)。Groups の import 文を探します。'Annotation\Groups' を 'Attribute\Groups' に変更します。ドキュメントが正しくビルドされるか確認して変更を検証し、関連する他のインポートを更新する必要がないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
PHP
スター
2.6k
フォーク
982
平均マージ
1日 16時間
マージ済み PR(30日)
59

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

api-platform/core のほかの issue

api-platform/core の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。