Dynamically configure validation groups on MapRequestPayload
and MapQueryString
attributes
#51012
-
Hi everyone - Is it possible to dynamically configure validation groups on the new I was imagining something like this: public function __invoke(
#[MapQueryString(validationGroups: OrdersQueryDtoGroupResolver::class)] OrdersQueryDto $query,
): Response {
// ...
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi, no currently this is not supported. |
Beta Was this translation helpful? Give feedback.
-
If the validation groups depend on the state of the underlying object you can use |
Beta Was this translation helpful? Give feedback.
If the validation groups depend on the state of the underlying object you can use
#[Assert\GroupSequenceProvider]
and determine the groups dynamically.https://symfony.com/doc/current/validation/sequence_provider.html#group-sequence-providers