feat: support P1 leaf JSON Schema constraints (#82) #84

Merged
xingyue merged 1 commits from feat/82-schema-p1-leaf-constraints into main 2026-06-01 01:26:51 +00:00
Owner

What

扩展 JSON Schema 支持,新增 10 个叶子约束关键字。

Changes

  • schema.tsALLOWED_SCHEMA_KEYS 白名单 +10,isValidSchema() 类型检查 +10
  • bootstrap.ts — meta-schema 新增对应 property 定义
  • schema.test.ts — 5 个新测试(numeric/string/array 约束、错误类型拒绝、嵌套属性约束)

新增关键字

分类 关键字
数值 minimum, maximum, exclusiveMinimum, exclusiveMaximum
字符串 minLength, maxLength, pattern
数组 minItems, maxItems, uniqueItems

这些都是纯叶子约束,不含子 schema,无 collectRefs() 影响。

Test

493 pass, 0 fail, build + lint clean

Ref

Refs #82

## What 扩展 JSON Schema 支持,新增 10 个叶子约束关键字。 ## Changes - `schema.ts` — `ALLOWED_SCHEMA_KEYS` 白名单 +10,`isValidSchema()` 类型检查 +10 - `bootstrap.ts` — meta-schema 新增对应 property 定义 - `schema.test.ts` — 5 个新测试(numeric/string/array 约束、错误类型拒绝、嵌套属性约束) ### 新增关键字 | 分类 | 关键字 | |------|--------| | 数值 | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum` | | 字符串 | `minLength`, `maxLength`, `pattern` | | 数组 | `minItems`, `maxItems`, `uniqueItems` | 这些都是纯叶子约束,不含子 schema,无 `collectRefs()` 影响。 ## Test 493 pass, 0 fail, build + lint clean ## Ref Refs #82
xiaoju added 1 commit 2026-06-01 01:14:16 +00:00
Add 10 new schema keywords to whitelist + meta-schema:
- numeric: minimum, maximum, exclusiveMinimum, exclusiveMaximum
- string: minLength, maxLength, pattern
- array: minItems, maxItems, uniqueItems

These are pure leaf constraints with no collectRefs() impact.
5 new tests covering validation, rejection, and nested usage.

Refs #82
xingyue merged commit bfec74fe8e into main 2026-06-01 01:26:51 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#84