Skip to content

ValidationRuleError ​

Represents one field-level validation error inside ValidationErrorResponse. It carries the stable numeric code, the machine-readable error identifier, and the message resolved into the request's language, which is the one field that is not safe to branch on.

Use this record when tests need to assert validation response contents or when application code manually builds a ValidationErrorResponse.

Fields

Code: long
A stable number derived from the validation message key, so a client can branch on it without matching English text, and adding rules never renumbers the existing ones.

Error: string
The machine-readable identifier derived from the same key, with every run of non-alphanumeric characters replaced by an underscore, such as validation_required_default.

ErrorDescription: string?
The localized message produced by the configured message resolver, which falls back to the message key itself when no message file defines it.

Type signature ​

csharp
public sealed record ValidationRuleError
{
    public required long Code { get; init; }
    public required string Error { get; init; }
    public required string? ErrorDescription { get; init; }
}

All packages are released under the MIT License.