using OrpaonVision.Core.Results; using OrpaonVision.Core.Validation; namespace OrpaonVision.Core.Validation; /// /// JSON Schema验证服务接口。 /// public interface IJsonSchemaValidator { /// /// 验证JSON字符串是否符合指定Schema。 /// /// 要验证的JSON字符串。 /// Schema类型。 /// Schema版本。 /// 取消令牌。 /// 验证结果。 Task> ValidateAsync(string jsonString, string schemaType, string schemaVersion = "1.0", CancellationToken cancellationToken = default); /// /// 验证配置快照JSON。 /// /// 快照JSON字符串。 /// 快照类型。 /// 取消令牌。 /// 验证结果。 Task> ValidateSnapshotAsync(string snapshotJson, string snapshotType, CancellationToken cancellationToken = default); /// /// 验证规则配置JSON。 /// /// 规则JSON字符串。 /// 规则类型。 /// 取消令牌。 /// 验证结果。 Task> ValidateRuleAsync(string ruleJson, string ruleType, CancellationToken cancellationToken = default); /// /// 验证推理结果JSON。 /// /// 推理结果JSON字符串。 /// 模型类型。 /// 取消令牌。 /// 验证结果。 Task> ValidateInferenceResultAsync(string inferenceJson, string modelType, CancellationToken cancellationToken = default); /// /// 获取支持的Schema类型列表。 /// /// 取消令牌。 /// Schema类型列表。 Task>> GetSupportedSchemaTypesAsync(CancellationToken cancellationToken = default); /// /// 获取Schema定义。 /// /// Schema类型。 /// Schema版本。 /// 取消令牌。 /// Schema定义。 Task> GetSchemaAsync(string schemaType, string schemaVersion = "1.0", CancellationToken cancellationToken = default); /// /// 验证并转换JSON为强类型对象。 /// /// 目标类型。 /// JSON字符串。 /// Schema类型。 /// Schema版本。 /// 取消令牌。 /// 转换结果。 Task> ValidateAndDeserializeAsync(string jsonString, string schemaType, string schemaVersion = "1.0", CancellationToken cancellationToken = default) where T : class; /// /// 验证强类型对象并序列化为JSON。 /// /// 源类型。 /// 要验证的对象。 /// Schema类型。 /// Schema版本。 /// 取消令牌。 /// 序列化结果。 Task> ValidateAndSerializeAsync(T obj, string schemaType, string schemaVersion = "1.0", CancellationToken cancellationToken = default) where T : class; }