fix: CLI put @schema uses putSchema() for recursive validation (#82) #86
Reference in New Issue
Block a user
Delete Branch "fix/82-meta-schema-nested-validation"
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
修复 CLI
ucas put @schema无法存入带类型约束的嵌套 schema 的问题。Why
meta-schema 的
properties子项定义为{ type: "object", additionalProperties: false }且没有声明properties,导致 ajv 验证拒绝所有带 key 的子对象(包括合法的{"type":"string","minLength":1})。isValidSchema()是正确的递归实现,但 CLI 的cmdPut走的是通用 ajv 路径。Changes
cli-json-cas/src/index.ts—cmdPut检测到目标为 meta-schema 时,走putSchema()路径(使用isValidSchema()递归验证),而非 ajvcli-json-cas/src/cli.test.ts— 新增 E2E 测试:ucas put @schema存入含minLength/maximum/uniqueItems等嵌套约束的 schemaTest
494 pass, 0 fail, build + lint clean
Ref
Refs #82
CLI 'ucas put @schema' now detects meta-schema target and routes through putSchema() which uses isValidSchema() — a proper recursive validator — instead of ajv against the meta-schema (which cannot express recursive constraints for nested property sub-schemas). This fixes the core issue where schemas with typed properties like {"type":"string","minLength":1} were rejected by the CLI path. Added CLI E2E test: put @schema with nested constraints (minLength, maximum, uniqueItems). 494 tests, 0 fail. Refs #82