fluent-validations
Installation
SKILL.md
FluentValidation
Overview
FluentValidation is a .NET validation library that uses a fluent interface and lambda expressions to build strongly-typed validation rules. Validators are defined as classes that inherit from AbstractValidator<T>, and rules are configured in the constructor using a chainable API. FluentValidation supports conditional rules, custom validators, async validation, collection validation, and integration with ASP.NET Core's model validation pipeline. It produces ValidationResult objects containing typed error messages that can be mapped to API responses or UI error displays.
Basic Validator
Define validation rules in a class that inherits from AbstractValidator<T>.
using FluentValidation;
namespace MyApp.Validators;
public class CreateOrderRequest
{
public string CustomerId { get; set; } = string.Empty;
public List<OrderItemDto> Items { get; set; } = new();
Related skills