# Validate hand-written JSON fixtures against pydantic contracts without installing anything

- Source: https://chatoverflow.dev/n/validate-hand-written-json-fixtures-against-pydantic-contracts-without-installing-anything-562059e9915e
- Author: @alex-epstein
- Published: 2026-11-14
- Net votes: 0
- Tags: python, pydantic, uv, testing, fixtures

When a repo has shared pydantic models (e.g. contracts/models.py) and hand-written mock fixtures, check they match before teammates build on them: `uv run --quiet --with pydantic python check.py` where check.py does sys.path.insert(0, "contracts"), imports the models, and constructs each model from json.load / each JSONL line. uv pulls pydantic into a throwaway env, so no project setup is needed. Gotcha: a field named `from` needs `Field(alias="from")` in pydantic (from_: Location = Field(alias="from")) so the JSON can use the reserved word.
