FluentValidation 9.0 - list of breaking changes
See original GitHub issueThis is a working list of the expected breaking changes in 9.0:
- Generic type parameters added to a couple of places (ChildValidatorAdaptor, IncludeRule)
- Remove support for netstandard1.1 and netstandard1.6
- Instead of net45 will support net461 as the new minimum
- Drop support for MVC5 and WebApi 2. These will continue to receive critical fixes for 8.x only.
- Remove
SetCollectionValidator
, which was deprecated with 8.0 (RuleForEach
is the alternative) - Remove
ReplacePlaceholderWithValue
andGetPlaceholder
fromMessageFormatter
- Remove
WithLocalizedMessage
andLocalizedStringSource
. Using the overload ofWithMessage
that takes a func can cover the use case of needing to work with strongly-typed resource wrappers. -
ResourceName
andResourceType
will be removed from IStringSource. -
ResourceName
removed fromValidationFailure
. - Removed
PropertyValidatorContext.Instance
- usePropertyValidatorContext.InstanceToValidate
instead. - DelegatingValidator removed.
- Email validation mode: defualt changed from regex, to asp.net core compatible.
- Syntax changes for advanced test helper (#1148)
- Severity changes (#1152)
- ComparisonProperty formatting (#1204)
- Rename
ShouldValidateAsync
(#1279) - Equal/Notequal now do ordinal comparisons for strings (#1301)
- Do not attempt to automatically infer property names from the presence of
DisplayNameAttribute
orDisplayAttribute
, as this no longer works properly with the way asp.net core handles localization. If you really want this behaviour back, add the following to startup:
ValidatorOptions.DisplayNameResolver = (type, memberInfo, expression) => {
return memberInfo.GetCustomAttribute<System.ComponentModel.DataAnnotations.DisplayAttribute>()?.GetName();
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
9.0 Upgrade Guide — FluentValidation documentation
FluentValidation 9.0 is a major release that included several breaking changes. Please review this document before upgrading from FluentValidation 8.x to 9.
Read more >FluentValidation 9 released - Jeremy Skinner JeremySkinner
FluentValidation 9 is now available. This release contains several new features and bug fixes, as well as some breaking changes.
Read more >FluentValidation changelog - Awesome .NET - LibHunt
FluentValidation changelog. A popular .NET validation library for building strongly-typed validation rules. All Versions. 29. Latest Version.
Read more >FluentValidation 9.0.1
Version Downloads Last updated
11.7.1 40,990 4 days ago
11.7.0 9,577 5 days ago
11.6.0 1,172,104 a month ago
Read more >FluentValidation 9.0.0-preview1
A validation library for .NET that uses a fluent interface to construct strongly-typed validation rules.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cjlotz so you’ll need to change your implementating to not be based on the
DelegatingValidator
, and instead switch to using FluentValidation’s condition API, which is done by passing aFunc<PropertyValidatorContext, bool>
to ApplyConditon that does the work that you’d previously be doing inside the DelegatingValidator.Hopefully that illustrates what you’ll need to do to port to 9.0. Note that FluentValidation 8.x switched internally from using DelegatingValidator to the conditon API a while back, so you can switch over to this today without needing to wait for 9.0.
Of course, the other option is that you could copy the
DelegatingValidator
from the 8.x source code into your own project if you want to keep using it (source), but I would highly recommend moving over to the condition API instead.If you have any further questions, could you open a separate issue? Thanks.
Other areas where we use the flexibility afforded by
DelegatingValidator
is also to specify when specific rules should/should not execute based on the current stack of requests (we call themIOperationSteps
) for the current request/operation being executed in the system.This allows us to specify rules like the following: