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

DenormalizationViolationFactory crash when GroupSequence is used

クローズ
#8,639 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@VincentLanglet がすでに取り組んでいます。

2026年10月6日 から。

  • #8645 @VincentLanglet による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
64/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php, symfony

調査の方向性

Start with src/Validator/DenormalizationViolationFactory.php around collectConstraints() and the reported call at line 130; compare how src/Symfony/Validator/Metadata/Property/ValidatorPropertyMetadataFactory.php handles GroupSequence. Reproduce with the provided PATCH test and GroupSequence; done when validation returns the expected 400 response without the type error and the relevant tests pass.

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

説明

API Platform version(s) affected: 5.0.2

Description

I have a patch operation

new Patch(
            denormalizationContext: ['groups' => ['update:slug-target']],
            security: "is_granted('slug_target.update', object)",
            validationContext: [
                'groups' => new Assert\GroupSequence(['Requirements', ['SlugTarget', 'update:slug-target']]),
            ],
        ),

which was working fine on 4.3. As soon as I bump on 5.0 I get an error in one of my tests

An error occurred","detail":"ApiPlatform\\Validator\\DenormalizationViolationFactory::collectConstraints(): Argument #3 ($validationGroups) must be of type ?array, Symfony\\Component\\Validator\\Constraints\\GroupSequence given, called in \/app\/vendor\/api-platform\/validator\/DenormalizationViolationFactory.php on line 130

My test was

$client->request('PATCH', '/slug-targets/'.$uuid, [
            'json' => ['quality' => null],
            'headers' => ['Content-Type' => 'application/merge-patch+json'],
        ]);
        static::assertResponseStatusCodeSame(400);

The purpose was to test the constraint

#[Assert\Choice(choices: [TranslationQuality::REVIEWED], message: 'slug_target.quality.choices', groups: ['update:slug-target'])]

applied on the quality field.

Possible Solution

It's clear that GroupSequence are not handled here @soyuka
https://github.com/api-platform/core/blob/6f77a4d70fea96bdc1c259749cecfdeb135e9704/src/Validator/DenormalizationViolationFactory.php#L129-L130

I'm not sure about the purpose of the DenormalizationViolationFactory class/method but maybe there is something to copy from the ValidatorPropertyMetadataFactory.
https://github.com/api-platform/core/blob/6f77a4d70fea96bdc1c259749cecfdeb135e9704/src/Symfony/Validator/Metadata/Property/ValidatorPropertyMetadataFactory.php#L155-L197

主要言語
PHP
スター
2.6k
フォーク
989
平均マージ
2日 4時間
マージ済み PR(30日)
90

環境構築

はじめの一歩

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

api-platform/core のほかの issue

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

似ている issue

PHP の issue をもっと見る

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

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