Headless.FluentValidation
0.4.15
dotnet add package Headless.FluentValidation --version 0.4.15
NuGet\Install-Package Headless.FluentValidation -Version 0.4.15
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Headless.FluentValidation" Version="0.4.15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Headless.FluentValidation" Version="0.4.15" />
<PackageReference Include="Headless.FluentValidation" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Headless.FluentValidation --version 0.4.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Headless.FluentValidation, 0.4.15"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Headless.FluentValidation@0.4.15
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Headless.FluentValidation&version=0.4.15
#tool nuget:?package=Headless.FluentValidation&version=0.4.15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Headless.FluentValidation
Extension library for FluentValidation providing enterprise-grade validators and utilities.
Problem Solved
Provides a comprehensive suite of common validators (phone numbers, national IDs, URLs, pagination) and standardized error handling, eliminating the need to rewrite common validation logic across projects.
Key Features
- Phone number validation (international, country-specific) via
libphonenumber-csharp - Egyptian National ID validation with checksum verification
- Collection validators (unique elements, min/max counts)
- Geo validators (latitude/longitude)
- Pagination validators (page index, page size, search query)
- URL validators (absolute URLs, HTTP/HTTPS)
ErrorDescriptorintegration for structured API responses- Automatic camelCase property path normalization
Installation
dotnet add package Headless.FluentValidation
Quick Start
using Headless.FluentValidation;
public sealed class UserValidator : AbstractValidator<User>
{
public UserValidator()
{
RuleFor(x => x.PhoneNumber).InternationalPhoneNumber();
RuleFor(x => x.Email).NotEmpty().EmailAddress();
RuleFor(x => x.Roles).MinimumElements(1).UniqueElements();
}
}
Usage
Phone Number Validation
RuleFor(x => x.Phone).BasicPhoneNumber(); // DataAnnotations check
RuleFor(x => x.Phone).PhoneNumber(u => u.CountryCode); // Country-specific
RuleFor(x => x.Phone).InternationalPhoneNumber(); // International format
Error Descriptor Integration
RuleFor(x => x.Total).GreaterThan(0)
.WithErrorDescriptor(new ErrorDescriptor("ORDER_TOTAL_INVALID", "Total must be positive."));
Processing Validation Results
var errors = result.Errors.ToErrorDescriptors(); // Dictionary<string, List<ErrorDescriptor>>
Available Validators
| Category | Validators |
|---|---|
| Phone | BasicPhoneNumber, PhoneNumber, InternationalPhoneNumber, PhoneCountryCode |
| National ID | EgyptianNationalId |
| Collection | MaximumElements, MinimumElements, UniqueElements |
| Geo | Latitude, Longitude |
| Pagination | PageIndex, PageSize, SearchQuery |
| URL | Url, HttpUrl |
| ID | Id (validates non-empty Guid, positive int/long) |
Configuration
No configuration required.
Dependencies
FluentValidationlibphonenumber-csharpHeadless.Extensions
Side Effects
None.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- CommunityToolkit.HighPerformance (>= 8.4.2)
- FluentValidation (>= 12.1.1)
- Headless.Extensions (>= 0.4.15)
- Humanizer.Core (>= 3.0.10)
- IdGen (>= 3.0.7)
- JetBrains.Annotations (>= 2025.2.4)
- libphonenumber-csharp (>= 9.0.30)
- Microsoft.Bcl.TimeProvider (>= 10.0.8)
- morelinq (>= 4.4.0)
- Nito.AsyncEx (>= 5.1.2)
- Nito.Disposables (>= 2.5.0)
- Polly.Core (>= 8.6.6)
- System.Reactive (>= 6.1.0)
- TimeZoneConverter (>= 7.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Headless.FluentValidation:
| Package | Downloads |
|---|---|
|
Headless.Api.FluentValidation
Package Description |
|
|
Headless.Api.Core
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.