FluentAnnotationsValidator 1.2.1
See the version list below for details.
dotnet add package FluentAnnotationsValidator --version 1.2.1
NuGet\Install-Package FluentAnnotationsValidator -Version 1.2.1
<PackageReference Include="FluentAnnotationsValidator" Version="1.2.1" />
<PackageVersion Include="FluentAnnotationsValidator" Version="1.2.1" />
<PackageReference Include="FluentAnnotationsValidator" />
paket add FluentAnnotationsValidator --version 1.2.1
#r "nuget: FluentAnnotationsValidator, 1.2.1"
#:package FluentAnnotationsValidator@1.2.1
#addin nuget:?package=FluentAnnotationsValidator&version=1.2.1
#tool nuget:?package=FluentAnnotationsValidator&version=1.2.1
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]
,[StringLength]
, etc. - Runtime error message resolution with localization fallback
.resx
-based resource binding with auto-assignedCultureInfo
- DSL configuration: target types, cultures, resource mapping, conventions
Quick Setup
Certainly — here’s a refined version that’s clearer, more discoverable, and contributor-friendly. It emphasizes the fluent entry point, scoped configuration, and conditional override with dynamic localization fallback:
Fluent Validation Configuration
Start with automatic rule generation via [ValidationAttribute]
, then layer culture and localization resources:
using FluentAnnotationsValidator.Extensions;
using System.Globalization;
services.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();
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 | 424 | 7/25/2025 |
2.0.0-preview.2.3 | 64 | 9/26/2025 |
2.0.0-preview.2.2 | 98 | 8/31/2025 |
1.2.2 | 556 | 7/23/2025 |
1.2.1 | 537 | 7/22/2025 |
1.2.0 | 552 | 7/22/2025 |
1.1.0 | 498 | 7/21/2025 |
Patch release: Improved culture-aware message formatting via FormatMessage(...) helper. Resource classes now auto-bind .Culture when WithCulture(...) is used. Added format extraction from common ValidationAttributes for localized error templates.