Kopticx.Validify
1.0.0
dotnet add package Kopticx.Validify --version 1.0.0
NuGet\Install-Package Kopticx.Validify -Version 1.0.0
<PackageReference Include="Kopticx.Validify" Version="1.0.0" />
<PackageVersion Include="Kopticx.Validify" Version="1.0.0" />
<PackageReference Include="Kopticx.Validify" />
paket add Kopticx.Validify --version 1.0.0
#r "nuget: Kopticx.Validify, 1.0.0"
#:package Kopticx.Validify@1.0.0
#addin nuget:?package=Kopticx.Validify&version=1.0.0
#tool nuget:?package=Kopticx.Validify&version=1.0.0
Kopticx.Validify
Validify is a lightweight validation filter for ASP.NET Core Minimal APIs that uses FluentValidation under the hood. It allows you to inject model validation seamlessly into your API pipeline using a simple and expressive syntax.
โจ Features
- โ Declarative model validation for Minimal APIs
- ๐ Integrates with FluentValidation validators
- ๐งฉ Plug-and-play with
Microsoft.Extensions.DependencyInjection - ๐ก๏ธ Prevents invalid requests from reaching your handlers
- ๐ฆ Available as a NuGet package
- โ๏ธ Compatible with Native AOT
๐ Installation
Install from NuGet:
dotnet add package Validify
โ๏ธ How it works
Validify registers a filter that intercepts requests before they hit your endpoint. If the request model is invalid, a 400 Bad Request is returned with validation details.
Example usage:
companiesApi.MapPost("/", PostUser)
.WithValidation<PostUserModel>();
๐ ๏ธ Setup
1. Register the service
builder.Services.AddValidify();
2. Create a FluentValidator
public class PostUserModelValidator : AbstractValidator<PostUserModel>
{
public PostUserModelValidator()
{
RuleFor(x => x.Username)
.NotEmpty().WithMessage("Username is required")
.MaximumLength(255).WithMessage("Must be less than 255 characters");
// More rules...
}
}
3. Register your FluentValidator's validators
services
.AddSingleton<IValidator<PostUserModel>, PostUserModelValidator>()
.AddSingleton<IValidator<PutUserModel>, PutUserModelValidator>();
๐ Native AOT Support
Validify is fully compatible with Native AOT for optimized, self-contained executables:
<IsAotCompatible>true</IsAotCompatible>
๐งฉ Register validation response types for source generation
To support HttpValidationProblemDetails responses in AOT scenarios, include it in your JsonSerializerContext:
[JsonSerializable(typeof(HttpValidationProblemDetails))]
public partial class AppJsonSerializerContext : JsonSerializerContext;
This ensures that validation error responses can be properly serialized when using source-generated System.Text.Json.
๐ Project Structure
ValidifyRegistration.cs: Registers all necessary servicesValidationEndpointExtensions.cs: Adds.WithValidation<T>()toRouteHandlerBuilderValidationFilter.cs: The filter that runs before your endpoint logic
๐ฆ NuGet Package
๐ฆ nuget.org/packages/Kopticx.Validify
๐งช Why use Validify?
- Prevent invalid models from hitting your business logic
- Use FluentValidation's full feature set
- Centralize validation behavior with clean syntax
- Built for performance and developer experience
๐ License
๐ Third-party licenses
Validify uses FluentValidation, licensed under the Apache 2.0 License.
See NOTICE file for more information.
| 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 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. |
-
net8.0
- FluentValidation (>= 12.0.0)
- FluentValidation.DependencyInjectionExtensions (>= 12.0.0)
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.0.0 | 202 | 7/2/2025 |