Zeta.AspNetCore
0.1.16
dotnet add package Zeta.AspNetCore --version 0.1.16
NuGet\Install-Package Zeta.AspNetCore -Version 0.1.16
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="Zeta.AspNetCore" Version="0.1.16" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zeta.AspNetCore" Version="0.1.16" />
<PackageReference Include="Zeta.AspNetCore" />
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 Zeta.AspNetCore --version 0.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Zeta.AspNetCore, 0.1.16"
#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 Zeta.AspNetCore@0.1.16
#: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=Zeta.AspNetCore&version=0.1.16
#tool nuget:?package=Zeta.AspNetCore&version=0.1.16
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Zeta
Zeta is a schema-first validation framework for .NET with a fluent, async-first API.
using Zeta;
var schema = Z.Schema<User>()
.Property(x => x.Email, s => s.Email())
.Property(x => x.Age, s => s.Min(18));
var result = await schema.ValidateAsync(new User("alice@example.com", 21));
if (!result.IsSuccess)
{
foreach (var error in result.Errors)
Console.WriteLine($"{error.PathString}: {error.Message}");
}
public sealed record User(string Email, int Age);
Quick Start
dotnet add package Zeta
# Optional: ASP.NET Core integration (Minimal APIs / Controllers)
dotnet add package Zeta.AspNetCore
# Optional: FastEndpoints integration
dotnet add package Zeta.FastEndpoints
Core Examples
1. Minimal API Validation
using Zeta;
using Zeta.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddZeta();
var app = builder.Build();
var createUserSchema = Z.Schema<CreateUserRequest>()
.Property(x => x.Email, s => s.Email())
.Property(x => x.Name, s => s.MinLength(2));
app.MapPost("/users", (CreateUserRequest request) => Results.Ok(request))
.WithValidation(createUserSchema);
app.Run();
public sealed record CreateUserRequest(string Email, string Name);
2. Context-Aware Rules with .Using(...)
var registerSchema = Z.Schema<RegisterRequest>()
.Using<RegisterContext>(async (input, sp, ct) =>
{
var repo = sp.GetRequiredService<IUserRepository>();
var exists = await repo.EmailExistsAsync(input.Email, ct);
return new RegisterContext(exists);
})
.Property(x => x.Email, s => s.Email())
.Refine((x, ctx) => !ctx.EmailExists, "Email already exists", "email_exists");
public sealed record RegisterRequest(string Email);
public sealed record RegisterContext(bool EmailExists);
3. Collection Validation with .Each(...)
var orderSchema = Z.Schema<CreateOrderRequest>()
.Property(x => x.Items, items => items
.Each(i => i
.Property(v => v.ProductId, s => s.NotEmpty())
.Property(v => v.Quantity, s => s.Min(1)))
.MinLength(1));
public sealed record CreateOrderRequest(List<OrderItem> Items);
public sealed record OrderItem(string ProductId, int Quantity);
This repository contains:
- Core package source:
src/Zeta - ASP.NET Core integration package source:
src/Zeta.AspNetCore - FastEndpoints integration package source:
src/Zeta.FastEndpoints - Source generators:
src/Zeta.SourceGenerators - Tests:
tests - Samples:
samples - Benchmarks:
benchmarks
Package Documentation
- Core validation package (
Zeta):src/Zeta/README.md - ASP.NET Core integration package (
Zeta.AspNetCore):src/Zeta.AspNetCore/README.md - FastEndpoints integration package (
Zeta.FastEndpoints):src/Zeta.FastEndpoints/README.md - Guides:
docs
Which package should I use?
Zeta: Use in any .NET app (Console, Worker, Blazor, MAUI, libraries).Zeta.AspNetCore: Add only when you need ASP.NET Core integration (Minimal APIs, Controllers, validation filters).Zeta.FastEndpoints: Add when you use FastEndpoints as your web framework.
Build and Test
dotnet build
dotnet test
Samples
# ASP.NET Core sample
dotnet run --project samples/Zeta.Sample.Api
# Blazor sample
dotnet run --project samples/Zeta.Sample.Blazor
# FastEndpoints sample
dotnet run --project samples/Zeta.Sample.FastEndpoints.Api
Benchmarks
Comparing Zeta against FluentValidation and DataAnnotations on .NET 10 (Apple M2 Pro).
| Method | Mean | Allocated |
|---|---|---|
| FluentValidation | 131.2 ns | 600 B |
| FluentValidation (Async) | 230.1 ns | 672 B |
| Zeta | 353.2 ns | 216 B |
| Zeta (Invalid) | 442.2 ns | 1,048 B |
| DataAnnotations | 627.9 ns | 1,848 B |
| DataAnnotations (Invalid) | 990.5 ns | 2,672 B |
| FluentValidation (Invalid) | 1,923.9 ns | 7,728 B |
| FluentValidation (Invalid Async) | 2,095.5 ns | 7,800 B |
Key findings:
- Allocates 64% less memory than FluentValidation on valid input (216 B vs 600 B)
- Allocates 7.4x less memory than FluentValidation on invalid input (1,048 B vs 7,728 B)
- 4.4x faster than FluentValidation when validation fails (442 ns vs 1,924 ns)
- 2.2x faster than DataAnnotations when validation fails (442 ns vs 991 ns)
Run benchmarks:
dotnet run --project benchmarks/Zeta.Benchmarks -c Release
Changelog
See CHANGELOG.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
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.16 | 140 | 3/1/2026 |
| 0.1.15 | 94 | 2/22/2026 |
| 0.1.14 | 95 | 2/19/2026 |
| 0.1.13 | 95 | 2/18/2026 |
| 0.1.12 | 99 | 2/17/2026 |
| 0.1.11 | 100 | 2/12/2026 |
| 0.1.10 | 106 | 2/11/2026 |
| 0.1.9 | 101 | 2/3/2026 |
| 0.1.8 | 104 | 1/29/2026 |
| 0.1.7 | 100 | 1/28/2026 |
| 0.1.6 | 106 | 1/27/2026 |
| 0.1.5 | 104 | 1/26/2026 |
| 0.1.4 | 107 | 1/24/2026 |
| 0.1.3 | 107 | 1/23/2026 |
| 0.1.2 | 104 | 1/23/2026 |