FluentValidation v8.5.0 Release Notes

Release Date: 2019-09-24 // over 4 years ago
  • ๐Ÿš€ Release notes

    • โž• Add support for ASP.NET Core 3.
    • โž• Add ASP.NET Core-compatible version of the email address validator.
    • โœ… Simplify the advanced test-helper syntax.
    • โž• Add support for defining child rules inline when using RuleForEach.
    • ValidatorDescriptor now has consistent handling of model-level rules.
    • RuleForEach can now access collection index in error message with {CollectionIndex} placeholder.
    • ๐ŸŒ Welsh language translations of default error messages.
    • ๐ŸŒ Hungrian language translations of default error messages.
    • ๐ŸŒ Indonesian language translations of default error messages.
    • Using RuleForEach combined with When has more intuitive behaviour.
    • ๐Ÿ›  Fixed order of rule execution when using async validation.

    Of these new features, the main one to note is the new ChildRules syntax. When defining a rule against a collection of complex types, rules for the child properties can be defined directly inline rather than having to use a child validator:

    public class CustomerValidator : AbstractValidator\<Customer\> { public CustomerValidator() { RuleForEach(x =\> x.Orders).ChildRules(order =\> { order.RuleFor(x =\> x.ProductName).NotNull(); order.RuleFor(x =\> x.Amount).GreaterThan(0); }); } }
    

    Downloads

    Binaries can be downloaded from nuget: