# Data flow — pydantic/pydantic

> Canonical page: https://codevetter.com/unpack/pydantic/data-flow

# Data flow — pydantic/pydantic

Scanned commit 29933d1c8cfc882a7640f4d831b09381b39aa311 (2026-10-01). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Type declarations first become field metadata, configuration, and executable core schemas. Validators and serializers retain those schemas while each validation call creates its own execution state. Input mode, aliases, context, and policy overrides travel into the Rust boundary. Results return as Python objects, structured errors, JSON bytes/strings, or JSON Schema dictionaries; persistence remains outside the main validation flow.
- Configuration merges base-class dictionaries, then class-body configuration, then recognized class keyword options; core_config translates selected keys and omits None values. — [pydantic/_internal/_config.py#L169-L189](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_config.py#L169-L189) [pydantic/_internal/_config.py#L203-L228](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_config.py#L203-L228)
- Field annotations and metadata enter _common_field_schema, which combines decorator validators, applies discriminator handling, wraps defaults, and installs field serializers. — [pydantic/_internal/_generate_schema.py#L1260-L1318](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_generate_schema.py#L1260-L1318)
- complete_model_class generates and cleans the schema, stores __pydantic_core_schema__, and installs a plugin-aware validator plus SchemaSerializer on the class. — [pydantic/_internal/_model_construction.py#L621-L661](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_model_construction.py#L621-L661)
- SchemaValidator.py_new builds a validator graph and definitions, retaining the original Python schema/configuration and error-display settings. — [pydantic-core/src/validators/mod.rs#L141-L183](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L141-L183)
- Python validation converts per-call extra behavior and enters _validate; that function creates recursion and ValidationState objects carrying strictness, context, input mode, aliases, and self_instance. — [pydantic-core/src/validators/mod.rs#L188-L215](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L188-L215) [pydantic-core/src/validators/mod.rs#L434-L467](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L434-L467)
- JSON validation checks the input byte representation, parses it with jiter::JsonValue::parse_with_config, then uses the same validator graph with InputType::Json and converts failures to ValidationError. — [pydantic-core/src/validators/mod.rs#L264-L296](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L264-L296) [pydantic-core/src/validators/mod.rs#L471-L510](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L471-L510)
- Model field validation returns a dictionary, extras, and fields-set tuple; ModelValidator writes these onto the instance and invokes post-init, with a separate root-model branch. — [pydantic-core/src/validators/model.rs#L249-L279](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/model.rs#L249-L279) [pydantic-core/src/validators/model.rs#L305-L327](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/model.rs#L305-L327) [pydantic-core/src/validators/model.rs#L367-L378](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/model.rs#L367-L378)
- Serialization produces JSON bytes and checks warnings before return; BaseModel decodes those bytes, while JSON Schema generation separately traverses the core schema, prunes/remaps definitions, and sorts the resulting dictionary. — [pydantic-core/src/serializers/mod.rs#L179-L193](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/serializers/mod.rs#L179-L193) [pydantic/main.py#L587-L604](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/main.py#L587-L604) [pydantic/json_schema.py#L432-L458](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/json_schema.py#L432-L458)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
