What problem does it solve?
This skill streamlines and standardizes request validation in .NET projects by encapsulating validation logic and promoting reusable patterns instead of scattered FluentValidation rules.
Core Features & Use Cases
- Request Validation Pattern: Centralize validation for incoming requests by exposing a static Validator on the request type.
- Validated String Type: Provide type-safe wrappers for common string inputs to enforce shape and basic constraints.
- Reusable Validators: Use ICached<T> to share a single validator instance across multiple requests to reduce allocations.
- Composition with ASP.NET Core: Seamlessly integrate with model binding and HasProblem for RFC 7807-style error responses.
- Use Case: When adding a new endpoint that accepts a request payload, you can generate a strongly-typed request with a cached validator and reuse the same validation rules across controllers.
Quick Start
Create a request class that implements IRequest<T>, define a static Validator using a cached validator in the same file, and use request.Validate() during handling.