Hyperbee.Pipeline.Validation.FluentValidation
3.0.0
dotnet add package Hyperbee.Pipeline.Validation.FluentValidation --version 3.0.0
NuGet\Install-Package Hyperbee.Pipeline.Validation.FluentValidation -Version 3.0.0
<PackageReference Include="Hyperbee.Pipeline.Validation.FluentValidation" Version="3.0.0" />
<PackageVersion Include="Hyperbee.Pipeline.Validation.FluentValidation" Version="3.0.0" />
<PackageReference Include="Hyperbee.Pipeline.Validation.FluentValidation" />
paket add Hyperbee.Pipeline.Validation.FluentValidation --version 3.0.0
#r "nuget: Hyperbee.Pipeline.Validation.FluentValidation, 3.0.0"
#:package Hyperbee.Pipeline.Validation.FluentValidation@3.0.0
#addin nuget:?package=Hyperbee.Pipeline.Validation.FluentValidation&version=3.0.0
#tool nuget:?package=Hyperbee.Pipeline.Validation.FluentValidation&version=3.0.0
Hyperbee.Pipeline.Validation.FluentValidation
The Hyperbee.Pipeline.Validation.FluentValidation library integrates FluentValidation with Hyperbee.Pipeline. This is the recommended package for most users who want to add validation to their pipelines.
Features
- Seamless FluentValidation Integration: Use your existing FluentValidation validators
- Automatic Registration: Scan assemblies and register validators automatically
- RuleSet Support: Execute specific RuleSets based on pipeline context
- Full Pipeline Integration:
ValidateAsync,IfValidAsync, and other pipeline extensions - Zero Configuration: Works out of the box with standard FluentValidation patterns
Installation
dotnet add package Hyperbee.Pipeline.Validation.FluentValidation
This package transitively includes:
Hyperbee.Pipeline.Validation(base implementations and extensions)FluentValidation(validation framework)
Quick Start
1. Create FluentValidation Validators
using FluentValidation;
public class CreateOrderValidator : AbstractValidator<CreateOrderInput>
{
public CreateOrderValidator()
{
RuleFor(x => x.CustomerId).NotEmpty();
RuleFor(x => x.Amount).GreaterThan(0);
RuleFor(x => x.Items).NotEmpty();
}
}
2. Register FluentValidation
using Hyperbee.Pipeline.Validation;
using Hyperbee.Pipeline.Validation.FluentValidation;
// Recommended: scan for validators automatically (Scoped lifetime by default)
services.AddPipelineValidation(config =>
config.UseFluentValidation(options =>
options.ScanAssembly(typeof(CreateOrderValidator).Assembly)));
// Singleton lifetime (validators with no per-request state)
services.AddPipelineValidation(config =>
config.UseFluentValidation(options =>
options.ScanAssembly(typeof(CreateOrderValidator).Assembly, ServiceLifetime.Singleton)));
// Include internal validator types
services.AddPipelineValidation(config =>
config.UseFluentValidation(options =>
options.ScanAssembly(typeof(CreateOrderValidator).Assembly, includeInternalTypes: true)));
// Alternative: if you already register FV validators separately
services.AddValidatorsFromAssemblyContaining<CreateOrderValidator>();
services.AddPipelineValidation(config => config.UseFluentValidation());
3. Use in Pipelines
var pipeline = PipelineBuilder
.Create<CreateOrderInput, Order>()
.ValidateAsync() // Validates using CreateOrderValidator
.Pipe((context, input) => CreateOrder(input))
.Build();
Examples
Basic Validation
var command = PipelineFactory
.Start<Order>()
.ValidateAsync()
.Pipe((ctx, order) => ProcessOrder(order))
.Build();
Conditional Execution on Validation
var command = PipelineFactory
.Start<Order>()
.ValidateAsync()
.IfValidAsync(builder => builder
.PipeAsync(async (ctx, order) => await SaveOrderAsync(order))
)
.Build();
RuleSet Validation
public class ProductCatalogValidator : AbstractValidator<ProductCatalog>
{
public ProductCatalogValidator()
{
// Always executed rules
RuleFor(x => x.Name).NotEmpty();
RuleFor(x => x.Quantity).GreaterThan(0);
// Create scenario - ID not required
RuleSet("Create", () =>
{
RuleFor(x => x.Quantity).LessThanOrEqualTo(1000);
});
// Update scenario - ID required
RuleSet("Update", () =>
{
RuleFor(x => x.Id).NotEmpty();
RuleFor(x => x.VersionTag).NotEmpty();
});
}
}
// Static RuleSet
var createPipeline = PipelineBuilder
.Start<ProductCatalog>()
.ValidateAsync("Create") // Uses Create RuleSet + default rules
.Pipe((ctx, catalog) => CreateItem(catalog));
// Dynamic RuleSet
var pipeline = PipelineBuilder
.Start<ProductCatalog>()
.ValidateAsync((ctx, catalog) => catalog.IsNew ? "Create" : "Update")
.Pipe((ctx, catalog) => SaveItem(catalog));
Checking Validation Results
var result = await command(context, input);
if (!context.IsValid())
{
foreach (var error in context.ValidationFailures())
{
Console.WriteLine($"{error.PropertyName}: {error.ErrorMessage}");
}
}
Exception Handling
var command = PipelineFactory
.Start<string>()
.WithExceptionHandling(config => config
.AddException<InvalidOperationException>(errorcode: 1001)
.AddException<TimeoutException>(errorcode: 1002)
)
.Pipe((ctx, arg) => $"hello {arg}")
.Build();
Migration from Hyperbee.Pipeline.Validation 1.x
If you're upgrading from version 1.x:
Before (v1.x)
<PackageReference Include="Hyperbee.Pipeline.Validation" />
services.AddSingleton<IValidatorProvider, ValidatorProvider>();
services.AddValidatorsFromAssemblyContaining<OrderValidator>();
After (v2.x)
<PackageReference Include="Hyperbee.Pipeline.Validation.FluentValidation" />
// Recommended
services.AddPipelineValidation(config =>
config.UseFluentValidation(options =>
options.ScanAssembly(typeof(OrderValidator).Assembly)));
// Or keep manual registration
services.AddValidatorsFromAssemblyContaining<OrderValidator>();
services.AddPipelineValidation(config => config.UseFluentValidation());
Pipeline code remains unchanged - all ValidateAsync() calls work exactly the same.
Advanced Scenarios
Using Multiple Validation Frameworks
You can use FluentValidation alongside custom validators:
// Some models use FluentValidation
public class OrderValidator : AbstractValidator<Order> { }
// Some models use custom validators
public class PaymentValidator : IValidator<Payment>
{
public Task<IValidationResult> ValidateAsync(Payment instance, CancellationToken ct = default)
{
// Custom validation logic
}
}
// FluentValidatorProvider handles both via the adapter pattern
services.AddPipelineValidation(config =>
config.UseFluentValidation(options =>
options.ScanAssembly(Assembly.GetExecutingAssembly())));
Related Packages
Hyperbee.Pipeline.Validation- Base implementations (for custom validators)
Dependencies
Hyperbee.Pipeline.Validation- Core validation (transitively included)FluentValidation- Validation framework
Target frameworks
net11.0, net10.0, netstandard2.1. A net8.0 or net9.0 project resolves the
netstandard2.1 asset; see the repository README.
On netstandard2.1 this package depends on FluentValidation 11.12, the last release line
with a netstandard2.1 asset. net10.0 and net11.0 use FluentValidation 12.
| 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 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. net11.0 is compatible. |
| .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. |
-
.NETStandard 2.1
- FluentValidation (>= 11.12.0)
- FluentValidation.DependencyInjectionExtensions (>= 11.12.0)
- Hyperbee.Pipeline.Validation (>= 3.0.0)
-
net10.0
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- Hyperbee.Pipeline.Validation (>= 3.0.0)
-
net11.0
- FluentValidation (>= 12.1.1)
- FluentValidation.DependencyInjectionExtensions (>= 12.1.1)
- Hyperbee.Pipeline.Validation (>= 3.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Hyperbee.Pipeline.Validation.FluentValidation:
| Package | Downloads |
|---|---|
|
Hyperbee.Pipeline.TestHelpers
Test helpers and fixtures for Hyperbee.Pipeline commands and validation |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 129 | 11/28/2026 |
| 2.16.1 | 121 | 11/26/2026 |
| 2.16.0 | 124 | 11/26/2026 |
| 2.15.0 | 7,840 | 7/15/2026 |
| 2.14.0 | 2,830 | 6/8/2026 |
| 2.13.0 | 999 | 5/19/2026 |
| 2.12.0 | 1,451 | 4/12/2026 |
| 2.11.1 | 1,909 | 3/26/2026 |
| 2.10.1-alpha-gc6f6d9837f | 152 | 3/25/2026 |
| 2.9.1 | 2,679 | 3/19/2026 |
| 2.9.0 | 169 | 3/19/2026 |
| 2.8.2 | 210 | 3/16/2026 |
| 2.7.0 | 2,594 | 2/28/2026 |
| 2.6.0 | 184 | 2/28/2026 |
| 2.5.0 | 186 | 2/28/2026 |
| 2.4.0 | 179 | 2/27/2026 |
| 2.3.3 | 4,513 | 2/24/2026 |
| 2.3.2 | 575 | 2/18/2026 |
| 2.3.1 | 180 | 2/18/2026 |
| 2.3.0 | 166 | 2/17/2026 |