Metadata-Version: 2.4
Name: schemax-cli
Version: 0.1.0
Summary: Infer JSON Schema from sample data — merge multiple examples, output Draft 2020-12 schemas.
Author-email: Marcus <marcus.builds.things@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/marcusbuildsthings-droid/schemax
Project-URL: Issues, https://github.com/marcusbuildsthings-droid/schemax/issues
Keywords: json,schema,infer,cli,jsonschema,developer-tools
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Dynamic: license-file

# schemax

Infer JSON Schema from sample data. Feed it one or more JSON files and get a clean, mergeable schema back.

## Install

```bash
pip install schemax-cli
```

## Usage

```bash
# 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 timestamps
- `date` — YYYY-MM-DD dates
- `time` — HH:MM:SS times
- `email` — Email addresses
- `uri` — HTTP(S) URLs
- `uuid` — UUIDs
- `ipv4` — 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](SKILL.md) for agent-optimized documentation.

## License

MIT
