Class ValidationFailure
- Namespace
- Stratara.Abstractions.Validation
- Assembly
- Stratara.Abstractions.dll
A single validation failure produced by an IValidator<T>. The shape mirrors FluentValidation's failure record so an adapter can map one-to-one without information loss.
public sealed record ValidationFailure : IEquatable<ValidationFailure>
- Inheritance
-
ValidationFailure
- Implements
- Inherited Members
- Extension Methods
Constructors
ValidationFailure(string, string, string?, object?, ValidationSeverity)
A single validation failure produced by an IValidator<T>. The shape mirrors FluentValidation's failure record so an adapter can map one-to-one without information loss.
public ValidationFailure(string PropertyName, string ErrorMessage, string? ErrorCode = null, object? AttemptedValue = null, ValidationSeverity Severity = ValidationSeverity.Error)
Parameters
PropertyNamestringThe name of the property that failed validation, or an empty string for object-level failures.
ErrorMessagestringA human-readable description of the failure.
ErrorCodestringAn optional machine-readable code a consumer can map to its own error model.
AttemptedValueobjectThe value that was rejected, when available.
SeverityValidationSeverityHow the failure is treated by the pipeline. Defaults to Error.
Properties
AttemptedValue
The value that was rejected, when available.
public object? AttemptedValue { get; init; }
Property Value
ErrorCode
An optional machine-readable code a consumer can map to its own error model.
public string? ErrorCode { get; init; }
Property Value
ErrorMessage
A human-readable description of the failure.
public string ErrorMessage { get; init; }
Property Value
PropertyName
The name of the property that failed validation, or an empty string for object-level failures.
public string PropertyName { get; init; }
Property Value
Severity
How the failure is treated by the pipeline. Defaults to Error.
public ValidationSeverity Severity { get; init; }