mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-04-02 11:44:28 +08:00
refactor(config): 优化YAML配置模式验证器中的允许值检查逻辑
- 将传统的空值检查和计数判断替换为更简洁的模式匹配语法 - 使用集合表达式简化代码结构,提高可读性 - 保持原有的功能逻辑不变,仅优化代码风格
This commit is contained in:
parent
ad87f72ca6
commit
c84f62897c
@ -398,8 +398,7 @@ internal static class YamlConfigSchemaValidator
|
||||
if (isValid)
|
||||
{
|
||||
var normalizedValue = NormalizeScalarValue(expectedType, value);
|
||||
if (allowedValues != null &&
|
||||
allowedValues.Count > 0 &&
|
||||
if (allowedValues is { Count: > 0 } &&
|
||||
!allowedValues.Contains(normalizedValue, StringComparer.Ordinal))
|
||||
{
|
||||
var enumSubject = isArrayItem
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user