Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(symfony): fix property restrictions for root resource with dynamic validation groups #6908

Conversation

c1tru55
Copy link
Contributor

@c1tru55 c1tru55 commented Jan 10, 2025

Q A
Branch? 4.0
Tickets Closes #..., closes #...
License MIT
Doc PR api-platform/docs#...
#[ApiResource(
    validationContext: [
        'groups' => [self::class, 'getValidationGroups'],
    ],
)]
class Foo

If root resource has dynamic validation groups - validation groups for it in ValidatorPropertyMetadataFactory are evaluated as plain array ['\App\Entity\Fee', 'getValidationGroups'] and as a result no constraint is found for these validation groups.

@soyuka
Copy link
Member

soyuka commented Jan 10, 2025

would you be able to add a non-regression test please?

@c1tru55
Copy link
Contributor Author

c1tru55 commented Jan 10, 2025

would you be able to add a non-regression test please?

unfortunately no :(

@soyuka soyuka merged commit dba9de1 into api-platform:4.0 Jan 17, 2025
59 checks passed
@soyuka
Copy link
Member

soyuka commented Jan 17, 2025

added the test for you :)

@c1tru55 c1tru55 deleted the fix-property-restrictions-for-root-resource-with-dynamic-validation-groups branch January 17, 2025 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants