-
Notifications
You must be signed in to change notification settings - Fork 0
EN FluentValidation
Vinícius Campos edited this page Aug 22, 2026
·
1 revision
Offside.FluentValidation turns FluentValidation failures into Offside Error values. It does not know about HTTP.
dotnet add package Offside.FluentValidationTargets: netstandard2.0, net8.0, net10.0.
| FluentValidation | Offside |
|---|---|
.WithErrorCode("email.taken") |
Error.Code (catalog key) |
Default NotEmptyValidator (and other *Validator names) |
code = validation
|
PropertyName |
Field (null when empty) |
AttemptedValue |
Arguments["attemptedValue"] |
| — |
Error.ErrorCode = VALIDATION
|
ErrorMessage |
discarded; the Offside catalog supplies the text |
RuleFor(x => x.Email).NotEmpty().WithErrorCode("email.required");
var result = validator.Validate(request).ToResult();Also: failures.ToOffsideErrors(), validationResult.ToOffsideErrors(), exception.ToOffsideErrors().
Add the same key to errors.json:
{ "email.required": "Email is required." }FastEndpoints hosts should use Offside.FastEndpoint instead of calling this from an endpoint by hand — that package already runs the mapper in the error pipeline.
Código e docs/ são canônicos · Code and docs/ are canonical · Base dbca345372483477097385eb43d850484b00ec13 · 2026-08-22 · Repositório / Repository