REslava.Result.FluentValidation
1.46.2
Prefix Reserved
See the version list below for details.
dotnet add package REslava.Result.FluentValidation --version 1.46.2
NuGet\Install-Package REslava.Result.FluentValidation -Version 1.46.2
<PackageReference Include="REslava.Result.FluentValidation" Version="1.46.2"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="REslava.Result.FluentValidation" Version="1.46.2" />
<PackageReference Include="REslava.Result.FluentValidation"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add REslava.Result.FluentValidation --version 1.46.2
#r "nuget: REslava.Result.FluentValidation, 1.46.2"
#:package REslava.Result.FluentValidation@1.46.2
#addin nuget:?package=REslava.Result.FluentValidation&version=1.46.2
#tool nuget:?package=REslava.Result.FluentValidation&version=1.46.2
REslava.Result.FluentValidation
⚠️ Optional — migration bridge only.
This package is not needed for new projects. REslava.Result already includes full validation natively via
[Validate](DataAnnotations →Result<T>) and the Validation DSL (19 fluent rules). Install this package only if your team already uses FluentValidation validators and wants to keep them while adopting REslava.Result.
FluentValidation bridge for REslava.Result — keep your existing validators, get Result<T> and SmartEndpoints auto-injection for free.
What It Does
A migration bridge for teams with existing FluentValidation validators who are adopting REslava.Result. Decorate your request type with [FluentValidate] and the generator emits:
Validate(IValidator<T> validator)— sync, runsvalidator.Validate(), returnsResult<T>ValidateAsync(IValidator<T> validator, CancellationToken)— async variant
SmartEndpoints auto-injection — when a POST/PUT body parameter is decorated with [FluentValidate], the generated Minimal API lambda automatically adds IValidator<T> as a parameter and emits the validation guard block.
Quick Start
dotnet add package REslava.Result
dotnet add package REslava.Result.SourceGenerators
dotnet add package REslava.Result.FluentValidation # ← bridge
dotnet add package FluentValidation # ← your existing validators
using REslava.Result.FluentValidation;
using FluentValidation;
// 1. Decorate the request type
[FluentValidate]
public record CreateOrderRequest(string CustomerId, decimal Amount);
// 2. Your existing FluentValidation validator — unchanged
public class CreateOrderRequestValidator : AbstractValidator<CreateOrderRequest>
{
public CreateOrderRequestValidator()
{
RuleFor(x => x.CustomerId).NotEmpty();
RuleFor(x => x.Amount).GreaterThan(0);
}
}
// 3. Register in DI
builder.Services.AddScoped<IValidator<CreateOrderRequest>, CreateOrderRequestValidator>();
// 4. Manual usage
IValidator<CreateOrderRequest> validator = new CreateOrderRequestValidator();
Result<CreateOrderRequest> result = request.Validate(validator);
// 5. SmartEndpoints — validator auto-injected, no extra wiring needed
[AutoGenerateEndpoints(RoutePrefix = "/api/orders")]
public class OrderService
{
public async Task<Result<Order>> CreateOrder(CreateOrderRequest req) => ...;
}
// app.MapOrderServiceEndpoints(); ← one line, validator injected automatically
Generated Code
For each type decorated with [FluentValidate]:
// namespace Generated.FluentValidationExtensions
public static class CreateOrderRequestFluentValidationExtensions
{
public static Result<CreateOrderRequest> Validate(
this CreateOrderRequest instance,
IValidator<CreateOrderRequest> validator)
{
var result = validator.Validate(instance);
if (result.IsValid)
return Result<CreateOrderRequest>.Ok(instance);
var errors = result.Errors
.Select(e => (IError)new ValidationError(e.PropertyName, e.ErrorMessage))
.ToList();
return Result<CreateOrderRequest>.Fail(errors);
}
public static async Task<Result<CreateOrderRequest>> ValidateAsync(
this CreateOrderRequest instance,
IValidator<CreateOrderRequest> validator,
CancellationToken cancellationToken = default) { ... }
}
SmartEndpoints Generated Lambda
ordersGroup.MapPost("/", async (
CreateOrderRequest req,
IValidator<CreateOrderRequest> reqValidator, // ← auto-injected
IOrderService svc,
CancellationToken cancellationToken) =>
{
var validation = req.Validate(reqValidator); // ← auto-emitted
if (!validation.IsSuccess) return validation.ToIResult();
var result = await svc.CreateOrder(req, cancellationToken);
return result.ToIResult();
});
Rules
[FluentValidate]and[Validate]cannot both be applied to the same type (RESL1006 analyzer error)- Users install
FluentValidation(≥ 11.x) separately — this package ships no runtime binary - Only
POST/PUTbody parameters trigger SmartEndpoints auto-injection (GET query params are skipped)
Requires
- REslava.Result (core library)
- REslava.Result.SourceGenerators (for SmartEndpoints)
- FluentValidation ≥ 11.x (installed by user)
Links
MIT License | Works with any .NET project (netstandard2.0)
| Product | Versions 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
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 |
|---|---|---|
| 1.54.0 | 113 | 4/6/2026 |
| 1.53.0 | 100 | 4/5/2026 |
| 1.52.0 | 100 | 3/30/2026 |
| 1.51.0 | 119 | 3/28/2026 |
| 1.50.1 | 96 | 3/25/2026 |
| 1.50.0 | 95 | 3/25/2026 |
| 1.49.0 | 97 | 3/24/2026 |
| 1.48.0 | 95 | 3/22/2026 |
| 1.47.5 | 97 | 3/22/2026 |
| 1.47.4 | 102 | 3/21/2026 |
| 1.47.3 | 105 | 3/20/2026 |
| 1.47.2 | 97 | 3/20/2026 |
| 1.47.1 | 101 | 3/18/2026 |
| 1.47.0 | 98 | 3/18/2026 |
| 1.46.3 | 100 | 3/18/2026 |
| 1.46.2 | 97 | 3/18/2026 |
| 1.46.1 | 94 | 3/17/2026 |
| 1.46.0 | 96 | 3/17/2026 |
| 1.45.0 | 96 | 3/17/2026 |
| 1.44.1 | 99 | 3/16/2026 |