Describe the bug
In a vanilla .NET 6 Blazor Server project, I am using Blazored.FluentValidation 2.1.0. When trying to validate a single property, as documented in the FluentValidation docs, it is triggering the validation for the whole form.
I've tried to create a .NET 6 MVC project and used FluentValidation 11.5.2 directly. As expected, only the provided property is being validated when I call Validate() by specifying the property in the IncludeProperties() method. Is there something wrong that I'm doing or missing from my side on Blazor Server?
To Reproduce
Create a FormModel.cs class
public class FormModel
{
public string? Name { get; set; }
public string? Email { get; set; }
public string? Comment { get; set; }
}
Create a FormModelValidator.cs class
public class FormModelValidator : AbstractValidator<FormModel>
{
public FormModelValidator()
{
RuleFor(x => x.Name).NotEmpty().WithMessage("Name is mandatory");
RuleFor(x => x.Email).NotEmpty().EmailAddress().WithMessage("Email is mandatory and must be valid");
RuleFor(x => x.Comment).NotEmpty().WithMessage("Comment is mandatory");
}
}
Describe the bug In a vanilla .NET 6 Blazor Server project, I am using Blazored.FluentValidation 2.1.0. When trying to validate a single property, as documented in the FluentValidation docs, it is triggering the validation for the whole form.
I've tried to create a .NET 6 MVC project and used FluentValidation 11.5.2 directly. As expected, only the provided property is being validated when I call
Validate()
by specifying the property in theIncludeProperties()
method. Is there something wrong that I'm doing or missing from my side on Blazor Server?To Reproduce
FormModel.cs
classFormModelValidator.cs
classProgram.cs
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
Hosting Model (is this issue happening with a certain hosting model?):
Additional context Add any other context about the problem here.