request/src/request.validation/Problem.cs

35 lines
No EOL
850 B
C#

// Copyright (c) The Geekeey Authors
// SPDX-License-Identifier: EUPL-1.2
namespace Geekeey.Request.Validation;
/// <summary>
/// Represents a validation problem identified during a request validation process.
/// </summary>
public record Problem
{
/// <summary>
/// The name of the property.
/// </summary>
public required PropertyPath PropertyPath { get; init; }
/// <summary>
/// Custom severity level associated with the failure.
/// </summary>
public Severity Severity { get; init; } = Severity.Error;
/// <summary>
/// The error message
/// </summary>
public required string Message { get; init; }
/// <summary>
/// Gets or sets the error code.
/// </summary>
public string? Code { get; init; }
/// <summary>
/// The property value that caused the failure.
/// </summary>
public object? AttemptedValue { get; init; }
}