Metadata-Version: 2.4
Name: schema2model
Version: 0.1.1
Summary: Convert JSON Schema to Pydantic models
Author: Till Hoffmann
License-Expression: MIT
Project-URL: Homepage, https://github.com/tillahoffmann/schema2model
Project-URL: Repository, https://github.com/tillahoffmann/schema2model
Project-URL: Issues, https://github.com/tillahoffmann/schema2model/issues
Keywords: json-schema,pydantic,code-generation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.12.5

# schema2model

[![CI](https://github.com/tillahoffmann/schema2model/actions/workflows/main.yml/badge.svg)](https://github.com/tillahoffmann/schema2model/actions/workflows/main.yml)
[![PyPI](https://img.shields.io/pypi/v/schema2model)](https://pypi.org/project/schema2model/)

Convert JSON Schema dictionaries to Pydantic models.

## Installation

```bash
pip install schema2model
```

## Usage

```python
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`)
