Skip to main content

JSON Schema to Pydantic model conversion library

Project description

Pydantic JSON Schema

CI Coverage PyPI Python Versions License: MIT Docs

Convert JSON Schema definitions into Pydantic models with runtime validation.

Installation

uv add pydantic-jsonschema

Requires Python 3.12+. See the installation guide for optional format validator extras.

Quick Start

from pydantic_jsonschema import Schema, to_model

schema = Schema.model_validate({
    "type": "object",
    "properties": {
        "name": {"type": "string"},
        "age": {"type": "integer", "minimum": 0},
    },
    "required": ["name"],
})

User = to_model(schema, model_name="User")

user = User(name="Alice", age=30)
print(user.model_dump())
#> {'name': 'Alice', 'age': 30}

Documentation

https://danipulok.github.io/pydantic-jsonschema/

License

MIT License - see LICENSE for details.

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

pydantic_jsonschema-0.0.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

pydantic_jsonschema-0.0.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_jsonschema-0.0.1.tar.gz.

File metadata

  • Download URL: pydantic_jsonschema-0.0.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pydantic_jsonschema-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e58e9b34b30d3bb3264c4e9386f53918f194f3982817200f2bfa0b3d0b980f39
MD5 f12e0d00e639b34f56aa193836300ceb
BLAKE2b-256 ac00dd159129d5d7cf1baf1259c56d20c74ca8a94328bc86a16a1fe95c4c49ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_jsonschema-0.0.1.tar.gz:

Publisher: release.yml on Danipulok/pydantic-jsonschema

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

File details

Details for the file pydantic_jsonschema-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_jsonschema-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68bcac68a12d3206876459f6a17724743f53f2a2ce2084cfa7757de6cc2a4cb7
MD5 eec5e5e7101f7302f9e07c12cc3931d9
BLAKE2b-256 95f9fdb50b8259d81fa95504a88972969e0a993e857edf917e1eb4cb50d12318

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_jsonschema-0.0.1-py3-none-any.whl:

Publisher: release.yml on Danipulok/pydantic-jsonschema

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