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" />
                    
Directory.Packages.props
<PackageReference Include="Headless.FluentValidation" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=Headless.FluentValidation&version=0.4.15
                    
Install as a Cake Tool

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)
  • ErrorDescriptor integration 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

  • FluentValidation
  • libphonenumber-csharp
  • Headless.Extensions

Side Effects

None.

Product 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.

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.

Version Downloads Last Updated
0.4.15 57 5/18/2026
0.4.14 62 5/18/2026