-
Notifications
You must be signed in to change notification settings - Fork 0
PT BR FluentValidation
Vinícius Campos edited this page Aug 22, 2026
·
2 revisions
Offside.FluentValidation transforma falhas do FluentValidation em Error do Offside. Não conhece HTTP.
dotnet add package Offside.FluentValidationTargets: netstandard2.0, net8.0, net10.0.
| FluentValidation | Offside |
|---|---|
.WithErrorCode("email.taken") |
Error.Code (chave do catálogo) |
Default NotEmptyValidator (e outros *Validator) |
code = validation
|
PropertyName |
Field (null se vazio) |
AttemptedValue |
Arguments["attemptedValue"] |
| — |
Error.ErrorCode = VALIDATION
|
ErrorMessage |
descartada; o catálogo Offside fornece o texto |
RuleFor(x => x.Email).NotEmpty().WithErrorCode("email.required");
var result = validator.Validate(request).ToResult();Também: failures.ToOffsideErrors(), validationResult.ToOffsideErrors(), exception.ToOffsideErrors().
Coloque a mesma chave em errors.json:
{ "email.required": "E-mail é obrigatório." }Hosts FastEndpoints devem usar Offside.FastEndpoint em vez de chamar isto à mão no endpoint — esse pacote já executa o mapper no pipeline de erro.
Código e docs/ são canônicos · Code and docs/ are canonical · Base dbca345372483477097385eb43d850484b00ec13 · 2026-08-22 · Repositório / Repository