Skip to main content

Convert JSON Schema to Pydantic models

Project description

schema2model

CI PyPI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schema2model-0.1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schema2model-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for schema2model-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fd03805e4265219d409954515c48ad8643937a31ea8b22595df72e1298b8bf52
MD5 a407a0914cc5f880722bf86aee9661df
BLAKE2b-256 14690d9ec12e0f6fb45d4014809ef77f74d43fbaaffdfb4ca021b054e553387c

See more details on using hashes here.

Provenance

The following attestation bundles were made for schema2model-0.1.1.tar.gz:

Publisher: main.yml on tillahoffmann/schema2model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for schema2model-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d29f8831fdaa53778e60d5eda1e56456dbf0b489ebc8da341672da06b52ba9cf
MD5 d8990776c8ea452b97b0c824c5587387
BLAKE2b-256 febb3b7736ba7c92e86b09f3c5c8c2e4d9748de6ca37f2b3707a8f380e8fe8fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for schema2model-0.1.1-py3-none-any.whl:

Publisher: main.yml on tillahoffmann/schema2model

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page