110 lines
2.5 KiB
C#
110 lines
2.5 KiB
C#
namespace OrpaonVision.Core.Validation;
|
||
|
||
/// <summary>
|
||
/// JSON Schema验证结果。
|
||
/// </summary>
|
||
public sealed class JsonSchemaValidationResult
|
||
{
|
||
/// <summary>
|
||
/// 是否验证通过。
|
||
/// </summary>
|
||
public bool IsValid { get; init; }
|
||
|
||
/// <summary>
|
||
/// 验证错误列表。
|
||
/// </summary>
|
||
public IReadOnlyList<JsonSchemaValidationError> Errors { get; init; } = [];
|
||
|
||
/// <summary>
|
||
/// 警告列表。
|
||
/// </summary>
|
||
public IReadOnlyList<JsonSchemaValidationWarning> Warnings { get; init; } = [];
|
||
|
||
/// <summary>
|
||
/// 验证耗时(毫秒)。
|
||
/// </summary>
|
||
public long ValidationTimeMs { get; init; }
|
||
|
||
/// <summary>
|
||
/// Schema版本。
|
||
/// </summary>
|
||
public string SchemaVersion { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 验证时间(UTC)。
|
||
/// </summary>
|
||
public DateTime ValidatedAtUtc { get; init; } = DateTime.UtcNow;
|
||
}
|
||
|
||
/// <summary>
|
||
/// JSON Schema验证错误。
|
||
/// </summary>
|
||
public sealed class JsonSchemaValidationError
|
||
{
|
||
/// <summary>
|
||
/// 错误代码。
|
||
/// </summary>
|
||
public string Code { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 错误消息。
|
||
/// </summary>
|
||
public string Message { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 错误路径。
|
||
/// </summary>
|
||
public string Path { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 错误严重程度。
|
||
/// </summary>
|
||
public string Severity { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 期望值。
|
||
/// </summary>
|
||
public string? ExpectedValue { get; init; }
|
||
|
||
/// <summary>
|
||
/// 实际值。
|
||
/// </summary>
|
||
public string? ActualValue { get; init; }
|
||
|
||
/// <summary>
|
||
/// 修复建议。
|
||
/// </summary>
|
||
public string? Suggestion { get; init; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// JSON Schema验证警告。
|
||
/// </summary>
|
||
public sealed class JsonSchemaValidationWarning
|
||
{
|
||
/// <summary>
|
||
/// 警告代码。
|
||
/// </summary>
|
||
public string Code { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 警告消息。
|
||
/// </summary>
|
||
public string Message { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 警告路径。
|
||
/// </summary>
|
||
public string Path { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 警告级别。
|
||
/// </summary>
|
||
public string Level { get; init; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 建议操作。
|
||
/// </summary>
|
||
public string? Recommendation { get; init; }
|
||
}
|