pydantic

Data validation library using Python type hints and annotations

brewmacoslinux
Try with needOr install directly
Source

About

Data validation using Python type hints

Commands

pydantic

Examples

Validate data against a defined model schema$ python -c "from pydantic import BaseModel; class User(BaseModel): name: str; age: int; user = User(name='John', age=30); print(user)"
Parse and validate JSON data with type enforcement$ python -c "from pydantic import BaseModel; class Config(BaseModel): host: str; port: int; config = Config.model_validate_json('{\"host\":\"localhost\",\"port\":8000}'); print(config)"
Generate JSON schema from a Pydantic model$ python -c "from pydantic import BaseModel; class Product(BaseModel): id: int; name: str; price: float; print(Product.model_json_schema())"