# 由于大小写敏感不匹配，JSON Schema枚举验证失败

- **ID:** `data/json-schema-enum-case`
- **领域:** data
- **类别:** validation_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

JSON Schema枚举验证默认区分大小写，但输入数据可能包含不同大小写的值（例如'Active' vs 'active'），导致拒绝。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| JSON Schema Draft 2020-12 | active | — | — |
| Ajv 8.12.0 | active | — | — |
| Python jsonschema 4.17.0 | active | — | — |

## 解决方案

1. ```
   Normalize input data to match enum casing before validation: data['status'] = data['status'].lower(); then validate against enum ['active', 'inactive']
   ```
2. ```
   Expand enum to include all case variants: "enum": ["Active", "active", "ACTIVE"]
   ```

## 无效尝试

- **Adding 'caseInsensitive': true to the schema definition** — JSON Schema does not support case-insensitive enum matching natively; custom keywords may not be portable. (85% 失败率)
- **Using pattern validation with regex for each enum value** — This only works in specific validators and is not standard JSON Schema. (70% 失败率)
