Validate, generate, and convert JSON Schemas with zero dependencies.
All commands use scripts/json_schema.py.
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 -
Auto-detects string formats (email, date-time, date, uri, ipv4).
python3 scripts/json_schema.py validate --schema schema.json --data data.json
Reports all validation errors with JSON paths. Exit code 1 on failure.
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
Supported formats: typescript, python-dataclass, markdown.
type, enum, required, properties, additionalProperties, items, minLength, maxLength, pattern, minimum, maximum, minItems, maxItems, format.
Use --input - to pipe JSON from stdin for both generate and validate --data.
共 1 个版本