Validate JSON data against JSON Schema, generate schemas from sample JSON, and convert schemas to TypeScript interfaces, Python dataclasses, or Markdown docs. Use when working with JSON validation, API contract testing, schema generation from examples, or converting JSON Schema to typed code. No external dependencies — pure Python.
零依赖地验证、生成和转换 JSON Schema。
所有命令均使用 scripts/json_schema.py。
bash
python3 scripts/json_schema.py generate --input sample.json
python3 scripts/json_schema.py generate --input sample.json --output schema.json
echo {name:Jo,age:25} | python3 scripts/json_schema.py generate --input -
自动检测字符串格式(email、date-time、date、uri、ipv4)。
bash
python3 scripts/json_schema.py validate --schema schema.json --data data.json
报告所有带有 JSON 路径的验证错误。验证失败时退出码为 1。
bash
python3 scripts/json_schema.py convert --input schema.json --format typescript
python3 scripts/json_schema.py convert --input schema.json --format python-dataclass
python3 scripts/json_schema.py convert --input schema.json --format markdown --name User
支持的格式:typescript、python-dataclass、markdown。
type、enum、required、properties、additionalProperties、items、minLength、maxLength、pattern、minimum、maximum、minItems、maxItems、format。
使用 --input - 从标准输入管道传输 JSON,适用于 generate 和 validate --data 命令。
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 json-schema-toolkit-1776104341 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 json-schema-toolkit-1776104341 技能
skillhub install json-schema-toolkit-1776104341
文件大小: 5.06 KB | 发布时间: 2026-4-17 15:08