core icon indicating copy to clipboard operation
core copied to clipboard

Adding a group to an assertion remove enum values in the doc

Open ecourtial opened this issue 1 year ago • 2 comments

API Platform version(s) affected: 3.3.11

Description

I use a basic #[Assert\Choice constraint.

   #[Assert\Choice(
        choices: self::ASSOCIATE_AS_VALUES,
        message: 'Choose a valid association mode.',
    )]

The documentation is properly generated with the values: 1

But as soon as I add a group to this assertion, the authorized choices are no longer displayed in the doc.

   #[Assert\Choice(
        choices: self::ASSOCIATE_AS_VALUES,
        message: 'Choose a valid association mode.',
        groups: ['firstSequencePost'],
    )]

2

ecourtial avatar Aug 03 '24 16:08 ecourtial

I also notice that it has an impact on the required label.

Before:

b2

After, I add a group to the NotNull assertion:

    #[Assert\NotNull(groups: ['firstSequencePost'])]
    #[Groups(['contract:post'])]
    public string $code;

b1

ecourtial avatar Aug 04 '24 07:08 ecourtial

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 05 '24 04:10 stale[bot]