Convert JSON Schema to Pydantic models
Project description
schema2model
Convert JSON Schema dictionaries to Pydantic models.
Installation
pip install schema2model
Usage
from schema2model import schema2model
schema = {
"title": "User",
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
},
"required": ["name", "age"]
}
User = schema2model(schema)
user = User(name="Alice", age=30)
Supported Features
- Basic types:
str,int,float,bool - Collections:
list,set,tuple,dict - Date/time:
datetime,date,time,timedelta - Special types:
UUID,bytes,AnyHttpUrl - Nested models and enums
- Recursive models
RootModel- Discriminated unions
- Field constraints (
gt,lt,min_length,pattern, etc.) - Field metadata (
description,examples,deprecated)
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 schema2model-0.1.1.tar.gz.
File metadata
- Download URL: schema2model-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd03805e4265219d409954515c48ad8643937a31ea8b22595df72e1298b8bf52
|
|
| MD5 |
a407a0914cc5f880722bf86aee9661df
|
|
| BLAKE2b-256 |
14690d9ec12e0f6fb45d4014809ef77f74d43fbaaffdfb4ca021b054e553387c
|
Provenance
The following attestation bundles were made for schema2model-0.1.1.tar.gz:
Publisher:
main.yml on tillahoffmann/schema2model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
schema2model-0.1.1.tar.gz -
Subject digest:
fd03805e4265219d409954515c48ad8643937a31ea8b22595df72e1298b8bf52 - Sigstore transparency entry: 737593121
- Sigstore integration time:
-
Permalink:
tillahoffmann/schema2model@5e9008f6053f088968c1a024a3a7e43cf740f743 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@5e9008f6053f088968c1a024a3a7e43cf740f743 -
Trigger Event:
push
-
Statement type:
File details
Details for the file schema2model-0.1.1-py3-none-any.whl.
File metadata
- Download URL: schema2model-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d29f8831fdaa53778e60d5eda1e56456dbf0b489ebc8da341672da06b52ba9cf
|
|
| MD5 |
d8990776c8ea452b97b0c824c5587387
|
|
| BLAKE2b-256 |
febb3b7736ba7c92e86b09f3c5c8c2e4d9748de6ca37f2b3707a8f380e8fe8fa
|
Provenance
The following attestation bundles were made for schema2model-0.1.1-py3-none-any.whl:
Publisher:
main.yml on tillahoffmann/schema2model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
schema2model-0.1.1-py3-none-any.whl -
Subject digest:
d29f8831fdaa53778e60d5eda1e56456dbf0b489ebc8da341672da06b52ba9cf - Sigstore transparency entry: 737593123
- Sigstore integration time:
-
Permalink:
tillahoffmann/schema2model@5e9008f6053f088968c1a024a3a7e43cf740f743 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tillahoffmann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@5e9008f6053f088968c1a024a3a7e43cf740f743 -
Trigger Event:
push
-
Statement type: