Skip to main content

Validation you can step through

Valiant Validation generates direct validators from compact, strongly typed rules. Author rules with fluent C#, model attributes, native branches, nested contexts, and reusable validators; then connect them to ASP.NET Core, OpenAPI, MediatR, or source-generated Mediator.

using Valiant.Validation;

[ValiantValidator]
public sealed partial class CreateUserValidator : ValidatorDefinition<CreateUser>
{
public override void Configure(ValidationContext<CreateUser> context)
{
context.Property(user => user.Name)
.Required()
.MaxLength(64);

context.Property(user => user.Age)
.GreaterThanOrEqualTo(18);
}
}

One rule model, several hosts

LayerIntegration
Domain/applicationInject IValidator<T> and call sync or async validation APIs
Minimal APIsAdd .WithValiantValidation() to a route
MVCRegister Valiant model validation globally
OpenAPIProject generated rule metadata into schema constraints and x-valiant-rules
MessagingAdd a MediatR or Mediator pipeline behavior

Validation results preserve property paths, codes, messages, and severity. Errors invalidate the result; warnings and information remain available without making it invalid.

Documentation map

The sample catalog covers every selectable core and ASP.NET Core scenario. The same behaviors are covered by sample-focused tests, including WebApplicationFactory tests for every web sample.