Qowaiv.Validation.Fluent
3.0.0
dotnet add package Qowaiv.Validation.Fluent --version 3.0.0
NuGet\Install-Package Qowaiv.Validation.Fluent -Version 3.0.0
<PackageReference Include="Qowaiv.Validation.Fluent" Version="3.0.0" />
<PackageVersion Include="Qowaiv.Validation.Fluent" Version="3.0.0" />
<PackageReference Include="Qowaiv.Validation.Fluent" />
paket add Qowaiv.Validation.Fluent --version 3.0.0
#r "nuget: Qowaiv.Validation.Fluent, 3.0.0"
#:package Qowaiv.Validation.Fluent@3.0.0
#addin nuget:?package=Qowaiv.Validation.Fluent&version=3.0.0
#tool nuget:?package=Qowaiv.Validation.Fluent&version=3.0.0
Qowaiv exensions on *Fluent Validation
Qowaiv provides a set of extensions on top of the FluentValidation library. It
allows to use FluentValidation in combination with Qowaiv's Result<T>.
Validators
There is a set of (generic purpose) validators to validate properties of a model.
Required
The RequiredValidation validates that a required property has a set value. If
specified, an unknown value can be seen as a set value, by default it is not.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.Email).Required();
RuleFor(m => m.Iban).Required(allowUnknown: true);
}
}
Not unknown
The UnknownValidation validates that a value does not equal the Unknown
value (if existing of course). Accessible via the fluent syntax.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.Email).NotEmptyOrUnknown();
RuleFor(m => m.Iban).NotUnknown();
}
}
(Not) before and (not) after
To have messages that use the phrasing '{PropertyName}' should be after {Value}
instead of '{PropertyName}' should be greater than {Value} makes sense for a
big range of property types, including date (time) related values.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.EndDate).After(m => Clock.Today().AddYears(20));
RuleFor(m => m.EndDate).NotAfter(m => Clock.Today().AddYears(20));
RuleFor(m => m.EndDate).Before(m => Clock.Today().AddYears(20));
RuleFor(m => m.EndDate).NotBefore(m => Clock.Today().AddYears(20));
}
}
Relative to the clock
The ClockValidation validates if a date (time) is in the past, or future.
It supports Date, DateTime, Date?, and DateTime?, and the provision
of custom date (time) provider. By Default, Clock.Now() and Clock.Today()
are used.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.Date1).InFuture();
RuleFor(m => m.Date2).InPast();
RuleFor(m => m.Date3).NotInFuture();
RuleFor(m => m.Date4).NotInPast(() => CustomeDateProvider());
}
}
Postal code valid for specific country
The PostalCodeValidation validates that a PostalCode value is valid for
a specific Country, both static and via another property.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.PostalCode).ValidFor(m => m.Country);
}
}
Finite floating points
The FloatingPointValidation validates that double and float values
are finite numbers.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.Number).IsFinite();
}
}
Email address should not be IP-based
The EmailAddressValidation validates that an EmailAddress
does not have an IP-based domain.
public class CustomValidator : AbstractValidator<Model>
{
public CustomValidator()
{
RuleFor(m => m.Email).NotIPBased();
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluentValidation (>= 12.1.1)
- Qowaiv (>= 7.4.7)
- Qowaiv.Validation.Abstractions (>= 2.0.0)
-
net8.0
- FluentValidation (>= 12.1.1)
- Qowaiv (>= 7.4.7)
- Qowaiv.Validation.Abstractions (>= 2.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Qowaiv.Validation.Fluent:
| Package | Downloads |
|---|---|
|
Qowaiv.Validation.TestTools
Qowaiv Validation supports a generic interface for (domain) model validation. |
|
|
Pmdevers.Common
Common boilerplate code for MinimalAPI Microservice |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 17,439 | 1/19/2026 |
| 2.0.0 | 47,744 | 11/19/2024 |
| 1.0.0 | 16,015 | 6/28/2024 |
| 0.3.1 | 6,256 | 3/15/2024 |
| 0.3.0 | 48,220 | 3/7/2023 |
| 0.2.1 | 21,336 | 4/13/2022 |
| 0.2.0 | 11,834 | 12/31/2021 |
| 0.1.1 | 15,368 | 9/10/2021 |
| 0.1.0 | 2,137 | 8/31/2021 |
| 0.0.7 | 5,470 | 6/4/2021 |
| 0.0.6 | 4,289 | 2/2/2021 |
| 0.0.5 | 3,485 | 7/30/2020 |
| 0.0.4 | 954 | 5/29/2020 |
| 0.0.3 | 878 | 4/9/2020 |
| 0.0.2 | 3,475 | 11/1/2019 |
| 0.0.1 | 1,997 | 7/30/2019 |
v3.0.
- `Before`, `After`, `NotBefore`, and `NotAfter` available for `IComparable`.
- Update to Qowaiv v7.4.7.
- Add .NET 10.0 target.
- Drop .NET standard, .NET 7.0, and .NET 9.0 targets. (BREAKING)
- Update to FluentValidation 12.1.0. (BREAKING)
v2.0.0
- Add .NET 9.0 target.
- Drop .NET 6.0 target. (BREAKING)
v1.0.0
- Drop support .NET 5.0 and .NET 7.0. (BREAKING)
- Update to Qowaiv v8.0.0.
- Update to FluentValidation v11.9.2. (BREAKING)
- ullable anotations. #48
- `InPast`, `NotInPast`, `InFuture`, and `NotInFuture` is now `Clock.UtcNow()`.
v0.3.1
- FIx so that Required to be current culture dependent. #74
- `.IsFinite()` for doubles and floats.
v0.3.0
- Support .NET 7.0. #62
v0.2.1
- Nullable anotations. #48
- , `InPast`, `NotInPast`, `InFuture`, and `NotInFuture` available for `DateOnly`. #49
v0.2.0
- Updated Qowaiv dependency.
v0.1.1
- Decorate pure methods with attribute. #38
v0.1.0
- Qowaiv.Validation.Abstractions dependency.
v0.0.7
- Update to FluentValidation v10.2.0.
v0.0.6
- ModelValidator instead of FluentModelValidator. #18
- Drop FluentValidator. #19
- Required with allow unknown is one rule now. #19 (fix)
v0.0.5
- Update to FluentValidation v9.0.1
v0.0.4
- Support `SetSeverity` and `WithMessage` on `NotEmptyOrUnknown`. #12 (fix)
v0.0.3
- Added `Required()`. #4
- Severity taken into account. #5 (fix)
v0.0.2
- Added Guards for null
v0.0.1
- Initial version