FluentAnnotationsValidator 1.2.2
See the version list below for details.
dotnet add package FluentAnnotationsValidator --version 1.2.2
NuGet\Install-Package FluentAnnotationsValidator -Version 1.2.2
<PackageReference Include="FluentAnnotationsValidator" Version="1.2.2" />
<PackageVersion Include="FluentAnnotationsValidator" Version="1.2.2" />
<PackageReference Include="FluentAnnotationsValidator" />
paket add FluentAnnotationsValidator --version 1.2.2
#r "nuget: FluentAnnotationsValidator, 1.2.2"
#:package FluentAnnotationsValidator@1.2.2
#addin nuget:?package=FluentAnnotationsValidator&version=1.2.2
#tool nuget:?package=FluentAnnotationsValidator&version=1.2.2
FluentAnnotationsValidator
A fluent, type-safe validation engine for .NET that transforms [ValidationAttribute]
annotations into runtime validation logic. Supports conditional rules, culture-scoped messages, and discoverable configuration via DSL.
Features
- Automatic validation from
[Required]
,[Range]
,[EmailAddress]
, etc. - Culture-aware localization from
.resx
or static resource classes - Conditional logic per property via
.When(...)
,.Localized(...)
,.UseFallbackMessage(...)
- Implicit rule generation based on global config (
.WithCulture(...)
,.WithValidationResource(...)
) - Smooth integration with ASP.NET and
IValidator<T>
- DSL configuration: target types, cultures, resource mapping, conventions
Quick Setup
Fluent Validation Configuration
Start with automatic rule generation via [ValidationAttribute]
, then layer culture and localization resources:
using FluentAnnotationsValidator.Extensions;
using System.Globalization;
services.AddFluentAnnotationsValidators(typeof(LoginDto))
.UseFluentAnnotations()
.For<LoginDto>()
.WithCulture(CultureInfo.GetCultureInfo("fr-FR"))
.WithValidationResource<ValidationMessages>() // Scoped .resx lookup
.Build();
Or inject conditional validation logic with localized error fallback:
services.UseFluentAnnotations()
.For<LoginDto>()
.WithCulture(CultureInfo.GetCultureInfo("fr-FR"))
.WithValidationResource<ValidationMessages>()
.When(x => x.Password, dto => string.IsNullOrEmpty(dto.Password))
.Localized("Password_Required") // Looks up ValidationMessages.Password_Required
.UseFallbackMessage("Mot de passe requis.") // Fallback if resource key is missing
.Build();
⚠️ Heads-up: Current version supports only one rule per property.
If a property has multiple[ValidationAttribute]
s, only the last one will be processed.
This will be resolved in v2.0.0 with full multi-attribute resolution.
v1.2.2 Highlights
- Fixed implicit rule synthesis for attributes lacking
.When(...)
- Respects global culture and resource bindings during fallback
- Improved configurator registry architecture for future rule aggregation
- Warning added for multi-attribute scenarios pending v2.0.0 release
Installation
dotnet add package FluentAnnotationsValidator --version 1.2.2
Test Coverage
- ✅
[Required]
,[EmailAddress]
,[MinLength]
,[Range]
support - ✅ Localized message binding from culture+resource
- ✅ Fallback behavior for
.Build()
without manual rule definitions
Learn More
Highlights
WithCulture(...)
bindsCultureInfo
globally across rules for this type.WithValidationResource<T>()
uses.resx
-backed messages with safe fallback.When(...)
applies targeted conditions with fluent chaining for per-property logic.Localized(...)
uses string keys like"Email_Required"
, typically mapped toValidationMessages
resource entries.
Documentation
See configuration guide for advanced usage.
Contribute
Open to feedback, extensions, and collaboration - shape validation ergonomics for developers worldwide.
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 was computed. 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. |
-
net8.0
- FluentValidation (>= 12.0.0)
- Microsoft.Extensions.Options (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.0.0-preview1 | 365 | 7/25/2025 |
1.2.2 | 489 | 7/23/2025 |
1.2.1 | 490 | 7/22/2025 |
1.2.0 | 479 | 7/22/2025 |
1.1.0 | 435 | 7/21/2025 |