DynamicEndpoints.FluentValidation 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DynamicEndpoints.FluentValidation --version 0.2.0
                    
NuGet\Install-Package DynamicEndpoints.FluentValidation -Version 0.2.0
                    
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="DynamicEndpoints.FluentValidation" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DynamicEndpoints.FluentValidation" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="DynamicEndpoints.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 DynamicEndpoints.FluentValidation --version 0.2.0
                    
#r "nuget: DynamicEndpoints.FluentValidation, 0.2.0"
                    
#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 DynamicEndpoints.FluentValidation@0.2.0
                    
#: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=DynamicEndpoints.FluentValidation&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=DynamicEndpoints.FluentValidation&version=0.2.0
                    
Install as a Cake Tool

DynamicEndpoints.FluentValidation

Use FluentValidation validators in DynamicEndpoints: runtime-defined HTTP endpoints for ASP.NET Core. Developers write a validator once, and admins attach it to any endpoint or parameter at runtime.

License: MIT

Register

builder.Services.AddDynamicEndpoints()
    .AddFluentValidatorsFromAssemblyContaining<Program>();   // or .AddFluentValidator<IbanValidator>("iban")

Names come from the type name (BookingRequestValidator → booking-request) or from [DynamicValidator("…")].

Request-level validators

The bound parameters are deserialized into your model. Error paths (CheckOut, Address.City) map back to the names used in the request.

public sealed record BookingRequest(DateOnly CheckIn, DateOnly CheckOut, int Guests, string RoomType);

public sealed class BookingRequestValidator : AbstractValidator<BookingRequest>
{
    public BookingRequestValidator() =>
        RuleFor(b => b.CheckOut).Must((b, o) => o.DayNumber - b.CheckIn.DayNumber <= 14).WithMessage("Max 14 nights.");
}

DynamicEndpoint.Post("/bookings").ValidatedBy<BookingRequestValidator>();

Parameter-level validators

Validators of scalar types (AbstractValidator<string>, <decimal>, …) validate a single parameter. Type compatibility is checked when a definition is saved, so an e-mail validator can't end up on an integer parameter.

public sealed class IbanValidator : AbstractValidator<string> { /* … */ }

DynamicEndpoint.Post("/invoices").FromBody("iban", p => p.Required().ValidatedBy<IbanValidator>());

Custom rules can reach the endpoint definition, the HttpContext and the configuration through ctx.GetDynamicContext().

📖 Documentation · 📝 Changelog

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

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.4.0 137 10/2/2026
0.3.0 110 10/2/2026
0.2.0 110 10/1/2026
0.1.2 109 10/1/2026
0.1.1 114 10/1/2026
0.1.0 106 10/1/2026