PineGuard.FluentValidation 0.1.0-alpha.7

This is a prerelease version of PineGuard.FluentValidation.
dotnet add package PineGuard.FluentValidation --version 0.1.0-alpha.7
                    
NuGet\Install-Package PineGuard.FluentValidation -Version 0.1.0-alpha.7
                    
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="PineGuard.FluentValidation" Version="0.1.0-alpha.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PineGuard.FluentValidation" Version="0.1.0-alpha.7" />
                    
Directory.Packages.props
<PackageReference Include="PineGuard.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 PineGuard.FluentValidation --version 0.1.0-alpha.7
                    
#r "nuget: PineGuard.FluentValidation, 0.1.0-alpha.7"
                    
#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 PineGuard.FluentValidation@0.1.0-alpha.7
                    
#: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=PineGuard.FluentValidation&version=0.1.0-alpha.7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PineGuard.FluentValidation&version=0.1.0-alpha.7&prerelease
                    
Install as a Cake Tool

PineGuard.FluentValidation

Already using FluentValidation? Don't rewrite your rules in a second dialect.

PineGuard.FluentValidation exposes every PineGuard rule as an IRuleBuilder extension — .Email(), .HttpsUrl(), .OwaspSafe(), and the rest — so AbstractValidator<T> reads exactly the way you expect. Same rule library as Must and Guard, same answer every time.

FluentValidation is the .NET idiom for request, command, and DTO validation — application requests, MediatR commands, ASP.NET Core models, and anywhere your pipeline needs a validator. It's a perfect fit for Clean Architecture, where the always-valid-state principle holds at the Application boundary: put your AbstractValidator<T> in the Application layer, run it before the handler, and nothing reaches your domain model that hasn't been cleaned first.

One rule library. Every call site in your architecture. The same Must.Be.Email your services call and the same Guard.Against.NotEmail your domain constructors call power RuleFor(x => x.Email).Email() in your validator. No parallel dialects. No drift. When the rule changes, every layer changes with it.

Install

dotnet add package PineGuard.FluentValidation

Targets net8.0, net10.0, and netstandard2.1. Depends on PineGuard.Core, PineGuard.MustClauses, and FluentValidation.

Examples

using FluentValidation;
using PineGuard.FluentValidation;

public sealed class CreateUserRequestValidator : AbstractValidator<CreateUserRequest>
{
    public CreateUserRequestValidator()
    {
        // The four canonical rules, as IRuleBuilder extensions
        RuleFor(x => x.Email).Required().Email();
        RuleFor(x => x.StrictEmailAddress).Required().StrictEmail();
        RuleFor(x => x.UserInput).Required().OwaspSafe();
        RuleFor(x => x.Callback).Required().HttpsUrl();
    }
}

Chain with FluentValidation's built-ins

PineGuard extensions compose with every FluentValidation API — .WithMessage(), .When(), .NotEmpty(), .MaximumLength(), and the rest — so you can stack PineGuard rules alongside length limits, conditional checks, and custom error messages on a single property.

RuleFor(x => x.Website)
    .Required()
    .HttpsUrl()
    .MaximumLength(256)
    .WithMessage("Website must be an HTTPS URL no longer than 256 characters.");

RuleFor(x => x.CompanyEmail)
    .Required()
    .StrictEmail()
    .When(x => x.IsCorporateUser);

RuleFor(x => x.Bio)
    .NotEmpty()
    .MaximumLength(500)
    .OwaspSafe();

A note on naming

FluentValidation already defines .NotNull() and .Null(). PineGuard uses .Required() / .NotRequired() for presence checks so the two libraries never collide. Every other rule keeps its natural name.

Other layers, same rule library

See the full documentation for the complete extension-method catalog.

License

MIT © Steve McCormack

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0-alpha.7 188 4/20/2026
0.1.0-alpha.6 66 4/20/2026
0.1.0-alpha.5 80 4/18/2026