Simple transform of jsonschema to pydantic models.
- primitive types
- objects
- arrays
- nested objects
- optional fields
- default values
pip install jsonschema-pydantic
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)
Run pytest test suite:
make test
Run all linters
make lint
Format python code:
make fmt
Generate documentation:
make docs
Read the CONTRIBUTING.md file.