docs(Config): 更新YAML配置文本验证器文档

- 为Validate方法添加详细的remarks文档说明同步加载schema的特性
- 为ValidateAsync方法添加cancellation token异常说明和异步加载schema的详细文档
- 补充异步验证方法的I/O密集场景适用性说明
This commit is contained in:
GeWuYou 2026-04-12 15:47:43 +08:00
parent 12e54ce637
commit 949904b57c

View File

@ -19,6 +19,9 @@ public static class YamlConfigTextValidator
/// <exception cref="ArgumentException">当 <paramref name="tableName" /> 或 <paramref name="schemaPath" /> 为空白时抛出。</exception>
/// <exception cref="ArgumentNullException">当 <paramref name="yamlPath" /> 或 <paramref name="yamlText" /> 为 <see langword="null" /> 时抛出。</exception>
/// <exception cref="GFramework.Game.Abstractions.Config.ConfigLoadException">当 schema 文件不可用,或 YAML 内容与 schema 不匹配时抛出。</exception>
/// <remarks>
/// 同步加载 schema 并立即校验,适合非异步上下文;内部委托 <see cref="YamlConfigSchemaValidator.Validate" /> 执行校验逻辑。
/// </remarks>
public static void Validate(
string tableName,
string schemaPath,
@ -41,6 +44,11 @@ public static class YamlConfigTextValidator
/// <exception cref="ArgumentException">当 <paramref name="tableName" /> 或 <paramref name="schemaPath" /> 为空白时抛出。</exception>
/// <exception cref="ArgumentNullException">当 <paramref name="yamlPath" /> 或 <paramref name="yamlText" /> 为 <see langword="null" /> 时抛出。</exception>
/// <exception cref="GFramework.Game.Abstractions.Config.ConfigLoadException">当 schema 文件不可用,或 YAML 内容与 schema 不匹配时抛出。</exception>
/// <exception cref="OperationCanceledException">当 <paramref name="cancellationToken" /> 已被触发时抛出。</exception>
/// <remarks>
/// 异步加载 schema调用 <see cref="YamlConfigSchemaValidator.LoadAsync" />)后同步执行校验,适合 I/O 密集场景;
/// 校验本身不涉及异步操作。
/// </remarks>
public static async Task ValidateAsync(
string tableName,
string schemaPath,