schema-to-erd
Convert JSON Schema (Draft 2020-12) into simple, human-friendly entity-relationship diagrams (ERDs).
schema-to-erd transforms JSON Schema definitions into clear diagrams that help technical and non-technical users understand data structures, entities, attributes, and relationships.
✨ Features
- Convert JSON Schema into ERD diagrams.
- Generate simplified, readable diagrams.
- Support standard JSON Schema definitions.
- Export diagrams in supported Graphviz formats, such as PNG.
- Use the tool from the command line or as a Python API.
📦 Installation
Install the package from PyPI:
pip install schema-to-erd
System requirement: Graphviz
The package requires Graphviz to be installed on your system.
macOS
brew install graphviz
Ubuntu/Debian
sudo apt update
sudo apt install graphviz
For other operating systems, see the Graphviz download page.
🚀 Quick Start: Command Line
Given a JSON Schema file named product.json, generate an ERD with:
schema-to-erd --input product.json
By default, the tool generates product.png in the current working directory.
CLI options
You can customise the output filename and format:
schema-to-erd --input product.json --out-file product-erd --format png
| Option | Required | Description |
|---|---|---|
--input |
Yes | Path to JSON schema file |
--out-file |
No | Output file name without the extension. Defaults to the input filename |
--format |
No | Output format (Default: png) |
For example, to generate an SVG diagram:
schema-to-erd --input product.json --out-file product-erd --format svg
The available formats depend on your Graphviz installation and the formats supported by the package.
🐍 Python API
You can also use schema-to-erd directly in your Python projects.
Basic usage
from schema_to_erd import build_erd_from_schema
build_erd_from_schema("product.json")
This uses the default settings and generates product.png in the current working directory.
Custom output filename and format
Use keyword arguments to specify the output filename and format:
from schema_to_erd import build_erd_from_schema
build_erd_from_schema(
json_file="product.json",
output="product-erd",
fmt="svg",
)
This generates product-erd.svg.
Function parameters
| Option | Required | Default | Description |
|---|---|---|---|
--input |
Yes | - | Path to JSON schema file |
--out-file |
No | Input filename without extension | Output file without the extension. |
--format |
No | "png". | Output format (default: png) |
The function generates a diagram file rather than returning the diagram itself.
🧪 Example
Input: product.json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Product",
"type": "object",
"properties": {
"productId": {
"type": "integer"
},
"productName": {
"type": "string"
}
}
}
Generate the diagram
schema-to-erd --input product.json
Expected diagram contents
The generated ERD represents the Product entity with these attributes:
productId— integerproductName— string
🧠 How It Works
The tool interprets JSON Schema structures to construct an ERD:
- Schema
title— used as the entity name. properties— represented as entity attributes.- Nested objects and references — used to identify relationships where supported by the implementation.
🛠️ Development
To work on the source code:
git clone https://github.com/khalsz/schema-to-ERD.git
cd schema-to-ERD
If you use uv:
uv sync --group dev
Alternatively, install the project in editable mode using pip:
pip install -e ".[dev]"
The pip command assumes your development dependencies are defined in the dev optional-dependency group.
🧪 Testing
Run the test suite with:
uv run pytest
Or, if you have installed the development dependencies in your active environment:
pytest
📄 License
This project is licensed under the MIT License. See the repository's license file for details.
🤝 Contributing
Contributions are welcome!
- Open an issue to report a bug or suggest an improvement.
- Submit a pull request with your proposed changes.
👤 Author
Built by Khalsz.
Metadata
Release files for schema-to-erd 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| schema_to_erd-0.1.2.tar.gz | 10.1 kB | Without provenance | Details for schema_to_erd-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| schema_to_erd-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for schema_to_erd-0.1.2-py3-none-any.whl |
Total release size: 19.3 kB
Release files / schema_to_erd-0.1.2.tar.gz
| Download URL | schema_to_erd-0.1.2.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c001f63de81bc7be82a96a040f1b3e318431575439cc235c4dcf9b28b420feb
|
|
BLAKE2b-256 checksum How to use checksums |
d5712ce873c1a3be84be43db8b4595066c045dff9d71f55ea0ec548cb4f6282e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / schema_to_erd-0.1.2-py3-none-any.whl
| Download URL | schema_to_erd-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e24a327f83797256e0ae5efed15acf38d19a1607f4aab4c2d99c3227c001f2eb
|
|
BLAKE2b-256 checksum How to use checksums |
0ef97e41b278e3e0fbf33f0888d4748b2ba262b04feb8a751d1cb4bfd0ed7bc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.14 {"installer":{"name":"uv","version":"0.12.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for schema-to-erd 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.