github FluentValidation/FluentValidation 9.5.0

latest releases: 11.10.0, 11.9.2, 11.9.1...
3 years ago

Release notes

Please read the upgrade guide if you are moving from 8.x to 9.x

Changes in 9.5.0

  • Introduce new syntax for applying transformations and deprecate the old syntax (#1613)

Changes in 9.4.0

  • ChildRules now work as expected when inside a ruleset (#1597)
  • Added ImplicitlyValidateRootCollectionElements option to MVC integration (#1585)

Changes in 9.3.0

  • Support for .NET 5 and ASP.NET Core 5
  • Improvements to LanguageManager's lazy loading of resources.
  • Deprecate IStringSource and its implementors. Use delegates instead.
  • CustomizeValidatorAttribute now works in Razor pages (netcore 3.1 and net 5.0 only) (#1541)
  • RuleSetForClientSideMessagesAttribute now works in Razor pages (netcore 3.1 and net 5.0 only) (#1544)
  • Fixes to Spanish translations.

Changes in 9.2.2

  • Fix one of the inheritance validator overloads not working correctly (#1528)

Changes 9.2.1

  • Add non-generic extensibility point to inheritance validator
  • Updates to Persian translations (#1513)
  • Added Bengali translations (#1517)

Changes in 9.2.0

Changes in 9.1.3

  • Fix an issue with IncludeRulesNotInRuleSet not working correctly (#1493)

Changes in 9.1.2

  • Make the ValidationContext.ThrowOnFailures getter public.

Changes in 9.1.1

  • Update incorrect wording in CascadeMode.StopOnFirstFailure deprecation warning.

Changes in 9.1.0

  • Add new Validate extension methods that allow options to be configured using a strategy (#1467)
  • Introduce CascadeMode.Stop and deprecate CascadeMode.StopOnFirstFailure to resolve confusion/abiguity about setting the cascade mode at validator-level (#1437)
  • RaiseValidationException can be overridden to customize the exception throwing process (#1162)
  • Make ruleset separator character splitting consistent (#1424)
  • Transform now works with RuleForEach (#1450)
  • Introduce constants for rulesets (#1435)
  • Resolve issue when attempting to use asynchronous conditions in a synchornous validaiton run (#1438)
  • Added asynchronous versions of the TestHelper methods (#1423)

Example of using the new validation strategy:

// Validate specific rulesets
validator.Validate(instance, opt => {
  opt.IncludeRuleSets("MyRuleSet", "SomeOtherRuleSet");
  
  // Can also force rules not in a ruleset to be run
  opt.IncludeRulesNotInRuleSet();
});

// Validate specific properties
validator.Validate(instance, opt => {
  opt.IncludeProperties("Forename", "Surname");
  // or
  opt.IncludeProperties(x => x.Surname, x.Forename);
});

// Throw exceptions on failure
validator.Validate(instance, opt => {
   opt.ThrowOnFailures();
});

// Combine various options
validator.Validate(instance, opt => {
  opt.IncludeRuleSets("MyRuleSet", "SomeOtherRuleSet").IncludeRulesNotInRuleSet();
  opt.ThrowOnFailures();
});

Downloads

Binaries can be downloaded from nuget:

Don't miss a new FluentValidation release

NewReleases is sending notifications on new releases.