-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Validate all groups when special group name *
is specified in validate()
method
#50679
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
base: 7.3
Are you sure you want to change the base?
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
e3de840
to
a279c56
Compare
I am afraid that doing this change would be a BC break in case someone actually uses this "special" group. |
I had a case of a large object graph (so object to be validated had several other objects with It very much seems like there should be an easy way to validate an entire object regardless of group metadata; it doesn't strike me as a particularly niche case. |
I'm happy to change the approach if necessary (open to discussion on that), or target 7.0. |
Yeah I mean you'll get a violation there, but that's expected behaviour because the constraints can't both be valid. If you had contradicting constraints, it'd be a solid indicator validating everything at once isn't your use case.
Possibly. I'd be interested to get more feedback on this and other options from other maintainers before I update the PR with any new approach. |
*
is specified in validate()
method
*
is specified in validate()
method*
is specified in validate()
method
@nicolas-grekas @fabpot had this PR open for about 18 months. I still believe it's a valuable feature to provide a way to validate all constraint groups on an object. If there are concerns still about the validation group name |
Adds a special group name
*
which can be used with the validator to validate all groups on the object being validated. This is comparable to how the group name*
can be used onSerializer
component, ref. https://symfony.com/doc/current/components/serializer.html#attributes-groups