Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

DenormalizationViolationFactory crash when GroupSequence is used

Aperta
#8,639 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@VincentLanglet ci sta già lavorando.

Dal 6/10/2026.

  • #8645 di @VincentLanglet — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
php, symfony

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
PHP
Stelle
2.6k
Fork
989
Merge medio
1g 19h
PR unite (30g)
87

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di api-platform/core

Tutte le issue di api-platform/core

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.