PydanticPluginProtocol
Protocol defining the interface for Pydantic plugins.
Methods
new_schema_validator()
@classmethod
def new_schema_validator(
schema: CoreSchema,
schema_type: Any,
schema_type_path: [SchemaTypePath](schematypepath.md?sid=pydantic_plugin_schematypepath),
schema_kind: SchemaKind,
config: CoreConfig | None,
plugin_settings: dict[str, object]
) - > tuple[ValidatePythonHandlerProtocol | None, ValidateJsonHandlerProtocol | None, ValidateStringsHandlerProtocol | None]
This method is called for each plugin every time a new [SchemaValidator][pydantic_core.SchemaValidator] is created. It should return an event handler for each of the three validation methods, or None if the plugin does not implement that method.
Parameters
| Name | Type | Description |
|---|---|---|
| schema | CoreSchema | The schema to validate against. |
| schema_type | Any | The original type which the schema was created from, e.g. the model class. |
| schema_type_path | [SchemaTypePath](schematypepath.md?sid=pydantic_plugin_schematypepath) | Path defining where schema_type was defined, or where TypeAdapter was called. |
| schema_kind | SchemaKind | The kind of schema to validate against. |
| config | `CoreConfig | None` |
| plugin_settings | dict[str, object] | Any plugin settings. |
Returns
| Type | Description |
|---|---|
| `tuple[ValidatePythonHandlerProtocol | None, ValidateJsonHandlerProtocol |