feat: P2 JSON Schema support — allOf, if/then/else, patternProperties, prefixItems (#82) #87
Reference in New Issue
Block a user
Delete Branch "feat/82-schema-p2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
#82 Phase 2:扩展 JSON Schema 支持,新增 10 个关键字,其中 4 个需要
collectRefs()适配。Changes
新增关键字
allOfif,then,elsepatternPropertiesprefixItemsmultipleOfminProperties,maxPropertiesdefault改动文件
schema.ts— 白名单 +10,isValidSchema()递归验证,collectRefs()遍历扩展bootstrap.ts— meta-schema 新增对应 property 定义schema.test.ts— 13 个新测试schema-validation.test.ts— 更新 meta-schema 结构断言cli-json-cas/src/index.ts— fix lint (unused var)collectRefs 改动要点
allOf: 所有子 schema 对同一 value 提取 refsif/then/else: 条件子 schema 对同一 value 提取 refspatternProperties: regex 匹配 key,对命中的 value 提取 refsprefixItems: 元组逐位提取 refs,items仅作用于 prefixItems 之后的元素Test
510 pass, 0 fail, build + lint clean
Ref
Refs #82