Infer JSON Schema from sample data — merge multiple examples, output Draft 2020-12 schemas.
Project description
schemax
Infer JSON Schema from sample data. Feed it one or more JSON files and get a clean, mergeable schema back.
Install
pip install schemax-cli
Usage
# Infer schema from a single file
schemax infer data.json
# Infer from multiple examples (schemas are merged)
schemax infer example1.json example2.json example3.json
# Infer from a JSON array (each element = sample)
schemax infer users.json
# From stdin
cat data.json | schemax infer -
# With title and compact output
schemax infer data.json --title "User" --compact
# Disable format detection
schemax infer data.json --no-formats
# Different draft version
schemax infer data.json --draft 7
Commands
| Command | Description |
|---|---|
schemax infer |
Infer JSON Schema from sample data |
schemax diff |
Show property differences across array elements |
schemax validate |
Validate JSON and show structure summary |
Format Detection
Automatically detects and annotates string formats:
date-time— ISO 8601 timestampsdate— YYYY-MM-DD datestime— HH:MM:SS timesemail— Email addressesuri— HTTP(S) URLsuuid— UUIDsipv4— IPv4 addresses
Multi-File Merging
When given multiple files (or a JSON array), schemax merges schemas intelligently:
- Object properties from all samples are combined
required= intersection (only keys present in ALL samples)- Types are widened (integer + number → number)
- Nullable fields are detected
- Conflicting types produce
anyOf
For AI Agents
See SKILL.md for agent-optimized documentation.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file schemax_cli-0.1.0.tar.gz.
File metadata
- Download URL: schemax_cli-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c76ca2ef3728f6815c4864c0084b2f3b16f0197ed7d23040d4fde26d429e7aaa
|
|
| MD5 |
a581da6b8afaaa114fe7dba488f5960c
|
|
| BLAKE2b-256 |
3c8fbfcd8ac76bed4b1d0fc7ec7a78018f671e7fca2ff77b1f8bb49e8e4428f5
|
File details
Details for the file schemax_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: schemax_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3df304ca7c05b4e77d725395fcacdd96409f308c62c945b4e8f182056cc91cb
|
|
| MD5 |
c00635d3cf6bcd8115f55bc5efbbc852
|
|
| BLAKE2b-256 |
5ef26e28790f30e167761d09cfbc002a67c6155668f5bbccbc78ebc5596e78cd
|