Skip to main content
Table of Contents

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

PropertyName string

The name of the property that failed validation, or an empty string for object-level failures.

ErrorMessage string

A human-readable description of the failure.

ErrorCode string

An optional machine-readable code a consumer can map to its own error model.

AttemptedValue object

The value that was rejected, when available.

Severity ValidationSeverity

How 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

object

ErrorCode

An optional machine-readable code a consumer can map to its own error model.

public string? ErrorCode { get; init; }

Property Value

string

ErrorMessage

A human-readable description of the failure.

public string ErrorMessage { get; init; }

Property Value

string

PropertyName

The name of the property that failed validation, or an empty string for object-level failures.

public string PropertyName { get; init; }

Property Value

string

Severity

How the failure is treated by the pipeline. Defaults to Error.

public ValidationSeverity Severity { get; init; }

Property Value

ValidationSeverity