everything is model_*.dict/.json/.parse_obj are v1-deprecated → model_dump/_json/validate
class Config is goneuse model_config = ConfigDict(...)
field_validator = classmethodbut model_validator(mode='after') is an instance method — return self
lax by default"5"→5; use strict=True or StrictInt to forbid coercion
mutable defaultsField(default_factory=list), never = []
Optional isn't optionalx: int | None still requires the key — add = None
mode='json' for JSON dictplain model_dump() keeps datetime/UUID as objects
exclude_unsetdumps only what was set — the PATCH-request pattern
prefer AnnotatedAnnotated[int, Field(gt=0)] beats x: int = Field(...)
TypeAdaptervalidate list[int] & friends with no model; build once, reuse
settings moved outpip install pydantic-settings — separate package in v2
before vs afterbefore sees raw input; after sees the coerced value
smart union picks bestnot first-match — use a discriminator or left_to_right for predictable dispatch
discriminated = tag fieldevery member needs a Literal tag; far faster than a plain union
recursive modelsquote the forward ref 'Node'; call model_rebuild() if unresolved
generics need subscriptBox[int](...) validates; bare Box leaves T as Any
model_copy skips validationlike model_construct — update= sets fields unchecked
schema has two modesmodel_json_schema(mode='serialization') ≠ 'validation'