Convert JSON Schemas to Pydantic models
Project description
jsonschema-pydantic
Simple transform of jsonschema to pydantic models.
Supported jsonschema features
- primitive types
- objects
- arrays
- nested objects
- optional fields
- default values
Install
pip install jsonschema-pydantic
Usage
from jsonschema_pydantic import jsonschema_to_pydantic
jsonschema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
},
"required": ["name"],
}
pydantic_model = jsonschema_to_pydantic(jsonschema)
Development
Run pytest test suite:
make test
Linting
Run all linters
make lint
Formatting
Format python code:
make fmt
Documentation
Generate documentation:
make docs
Contributions
Read the CONTRIBUTING.md file.
Project details
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 jsonschema_pydantic-0.6.tar.gz.
File metadata
- Download URL: jsonschema_pydantic-0.6.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6069a8929a333a7c7ea8510e9de50f062e747e655e6ba106da5af1981f995270
|
|
| MD5 |
07df896d975ad3d48fa34776cb9350f1
|
|
| BLAKE2b-256 |
d43e088097e87f6b24b162cd42b090b1d3891b68e9dac96ceeac8ed5dff94db7
|
File details
Details for the file jsonschema_pydantic-0.6-py3-none-any.whl.
File metadata
- Download URL: jsonschema_pydantic-0.6-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98385ed53ab87598665956b43756746350e2b60411a38381231f9703d36e40eb
|
|
| MD5 |
cb347b6c5c86b1b96b856ee41aaf0aea
|
|
| BLAKE2b-256 |
e767cbb63be985519b51d13499e726db2c960069588d5c2c479859856158b4de
|