model_schema
A model schema generally contains a typed-dict schema. It will run the typed dict validator, then create a new class and set the dict and fields set returned from the typed dict validator to __dict__ and __pydantic_fields_set__ respectively.
def model_schema(
cls: type[Any],
schema: CoreSchema,
generic_origin: type[Any] | None = None,
custom_init: bool | None = None,
root_model: bool | None = None,
post_init: str | None = None,
revalidate_instances: Literal['always', 'never', 'subclass-instances'] | None = None,
strict: bool | None = None,
frozen: bool | None = None,
extra_behavior: ExtraBehavior | None = None,
config: CoreConfig | None = None,
ref: str | None = None,
metadata: dict[str, Any] | None = None,
serialization: SerSchema | None = None
) - > ModelSchema
A model schema generally contains a typed-dict schema. It will run the typed dict validator, then create a new class and set the dict and fields set returned from the typed dict validator to __dict__ and __pydantic_fields_set__ respectively.
Parameters
| Name | Type | Description |
|---|---|---|
| cls | type[Any] | The Python class to be instantiated and populated by the model validator |
| schema | CoreSchema | The underlying schema (typically a model_fields_schema) used to validate the model's data |
| generic_origin | `type[Any] | None` = None |
| custom_init | `bool | None` = None |
| root_model | `bool | None` = None |
| post_init | `str | None` = None |
| revalidate_instances | `Literal['always', 'never', 'subclass-instances'] | None` = None |
| strict | `bool | None` = None |
| frozen | `bool | None` = None |
| extra_behavior | `ExtraBehavior | None` = None |
| config | `CoreConfig | None` = None |
| ref | `str | None` = None |
| metadata | `dict[str, Any] | None` = None |
| serialization | `SerSchema | None` = None |
Returns
| Type | Description |
|---|---|
ModelSchema | A dictionary representing the Pydantic Core model schema configuration |