CodeVetter · Repo Unpack · Feature catalog
pydantic/pydantic
User-facing functionality is exposed through Python APIs rather than application routes or screens. BaseModel and TypeAdapter cover structured and arbitrary typed data, with dedicated wrappers for dataclasses and function calls. Field metadata, custom validators, serializers, and specialized types refine those contracts. JSON Schema export and instrumentation plugins support integration with surrounding developer systems.
- BaseModel supports keyword construction, Python-object validation with optional attribute extraction, and JSON validation; call options include strictness, extra-field behavior, context, and alias/name selection.
- model_dump returns Python data and model_dump_json returns a string; both support inclusion/exclusion, unset/default/None filtering, context, round-trip behavior, fallbacks, and serialization warning policy.
- TypeAdapter builds or reuses a schema for an arbitrary type, validates Python or JSON input, supports experimental partial validation, and returns JSON bytes from dump_json.
- pydantic.dataclasses.dataclass wraps stdlib dataclasses with initialization validation and optional assignment validation; validate_on_init=False is rejected.
- validate_call validates function arguments and optionally return values, preserving wrapper identity and supporting coroutine functions with validation after awaiting their result.
- FieldInfo represents defaults/factories, distinct validation and serialization aliases, exclusions, tagged-union discriminators, frozen fields, and constraints; decorators and Annotated handlers add custom validation and serialization.
- Specialized APIs include root-value models, runtime create_model factories, ImportString resolution, filesystem path checks, masked secret types, and normalized email validation with deliverability checks disabled.
- JSON Schema export supports validation/serialization modes and selectable union representation; plugins receive schema identity and settings plus optional handlers for Python, JSON, and string validation.