Codex Validate Python Input with Pydantic and pytest
Model external mappings at a Python service boundary and test valid, missing, and out-of-range input.
中文Install in Codex
Use a local Python project and its Pydantic and pytest versions.
- Copy the pinned `skills/python/` directory into `.agents/skills/python/` in the project.
- Read `pyproject.toml` in Codex and identify the target input model and error conventions.
Example task
Define `report_name` as text and `max_rows` as a positive integer. Test values 15, zero, and absent to document accepted and rejected input.What to check
The model accepts valid data and returns field-specific validation errors for the other cases, with a repeatable test entry point.
Original SKILL.md on GitHub · Updated
Frequently asked question
Should every internal object use Pydantic too?
Use runtime validation at external boundaries. A dataclass or typed mapping may suit controlled internal objects.