-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Messenger] Document the validation middleware #10474
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
Comments
This one looks critical to me. Can any maintainer say what kind of documentation you want? Possibilities I see are:
For the record adding it to the middleware list is to do like this: framework:
messenger:
buses:
command_bus:
middleware:
- messenger.middleware.validation class CreateUser
{
/**
* @Assert\Uuid()
* @Assert\NotBlank()
*/
private $uuid;
/**
* @Assert\Lenght(min=3)
* @Assert\NotBlank()
*/
private $username;
public function __construct(string $uuid, string $username)
{
$this->uuid = $uuid;
$this->username = $username;
}
public function getUuid(): string
{
return $this->uuid;
}
public function getUsername(): string
{
return $this->username;
}
} The middleware will throw a |
Thank you for this issue. |
no |
@Nek- @ogizanagi I’ve opened a related PR |
Original PR: symfony/symfony#26648
An issue was already opened some times ago: #9641
and closed by 2099d48 but there is actually no mention to the
ValidationMiddleware
and how to use it (ValidationFailedException
should also be explained, as it allows getting the violations).Only the
ValidationConfiguration
is mentioned in https://symfony.com/doc/current/components/messenger.html#adding-metadata-to-messages-envelopes but I think this middleware deserves its own section/guide.The text was updated successfully, but these errors were encountered: