# Extension points — pydantic/pydantic

> Canonical page: https://codevetter.com/unpack/pydantic/extension-points

# Extension points — 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.

Most application extensions attach to public schema hooks, Annotated metadata, decorators, factories, or plugin protocols. JSON Schema generation offers an explicit generator subclass boundary separate from executable-schema generation. Installed validation plugins wrap three input methods without replacing the underlying Rust validator. Adding a native schema kind requires coordination with fixed dispatch and schema definitions.
- Custom types can implement __get_pydantic_core_schema__; GenerateSchema supplies CallbackGetCoreSchemaHandler and normalizes returned definitions/references, while skipping BaseModel's compatibility implementation. — [pydantic/_internal/_generate_schema.py#L953-L992](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_generate_schema.py#L953-L992)
- Annotated handlers such as AfterValidator and PlainSerializer compose a generated inner schema with Python callbacks and, for serializers, an optional generated return schema. — [pydantic/functional_validators.py#L75-L87](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/functional_validators.py#L75-L87) [pydantic/functional_serializers.py#L65-L86](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/functional_serializers.py#L65-L86)
- field_validator and field_serializer register PydanticDescriptorProxy metadata; class construction collects it, and _common_field_schema applies matching field handlers. — [pydantic/functional_validators.py#L503-L520](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/functional_validators.py#L503-L520) [pydantic/functional_serializers.py#L296-L306](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/functional_serializers.py#L296-L306) [pydantic/_internal/_model_construction.py#L146-L151](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_model_construction.py#L146-L151) [pydantic/_internal/_generate_schema.py#L1269-L1312](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_generate_schema.py#L1269-L1312)
- JSON Schema customization uses __get_pydantic_json_schema__ metadata hooks or a GenerateJsonSchema subclass supplied to model_json_schema; schema tags map to named *_schema methods. — [pydantic/_internal/_generate_schema.py#L796-L801](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/_internal/_generate_schema.py#L796-L801) [pydantic/json_schema.py#L324-L340](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/json_schema.py#L324-L340) [pydantic/json_schema.py#L2733-L2739](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/json_schema.py#L2733-L2739) [pydantic/json_schema.py#L2767-L2778](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/json_schema.py#L2767-L2778)
- Validation instrumentation plugins register in entry-point group pydantic and implement new_schema_validator, returning optional Python/JSON/string handlers; PYDANTIC_DISABLE_PLUGINS supports global disablement or named exclusions. — [tests/plugin/pyproject.toml#L10-L11](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/tests/plugin/pyproject.toml#L10-L11) [pydantic/plugin/__init__.py#L37-L67](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/plugin/__init__.py#L37-L67) [pydantic/plugin/_loader.py#L27-L48](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/plugin/_loader.py#L27-L48)
- create_model accepts bases, configuration, validators, namespace attributes, and field definitions, checks namespace clashes, and delegates class creation to the resolved metaclass. — [pydantic/main.py#L1834-L1843](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/main.py#L1834-L1843) [pydantic/main.py#L1873-L1908](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/main.py#L1873-L1908) [pydantic/main.py#L1914-L1939](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/main.py#L1914-L1939)
- Native validators plug into BuildValidator implementations selected by EXPECTED_TYPE in build_validator_inner; unknown type tags error, and supported executable schema kinds are constrained by the Python/Rust contract. — [pydantic-core/src/validators/mod.rs#L538-L564](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/mod.rs#L538-L564) [pydantic-core/src/validators/call.rs#L25-L43](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic-core/src/validators/call.rs#L25-L43) [docs/internals/architecture.md#L39-L45](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/docs/internals/architecture.md#L39-L45)
- The Mypy plugin factory returns PydanticPlugin, whose hooks transform BaseModel subclasses, model metaclasses, from_orm calls, and create_model dynamic classes; configuration data participates in cache invalidation. — [pydantic/mypy.py#L121-L176](https://github.com/pydantic/pydantic/blob/29933d1c8cfc882a7640f4d831b09381b39aa311/pydantic/mypy.py#L121-L176)

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)
