| Features | - schemas for primitives, objects, arrays, tuples, unions, discriminated unions, records, maps, sets, enums
- parse / safeParse and async variants returning a typed deep clone
- z.infer, z.input and z.output to extract static types
- refinements, transforms, coercion and async validation
- ZodError with structured issues and paths
- z.toJSONSchema(): Draft 2020-12 by default, Draft-07, Draft-04 and OpenAPI 3.0 targets
- z.fromJSONSchema() (experimental)
- z.compile() ahead-of-time compiled fast path
- All 13 features
| - models defined with Python type hints (BaseModel)
- validation core written in Rust
- strict and lax modes
- JSON Schema generation
- validates dataclasses, TypedDicts and standard library types
- custom validators and serializers
- TypeAdapter for validating any type
- settings management with pydantic-settings
|
| Limitations | - Doesn't support TypeScript versions before 5.5: it's tested on TypeScript 5.5 and later and needs strict mode
- Doesn't convert every schema to JSON Schema: bigint, date, map, set, transform and custom types have no equivalent and throw by default
| - Pydantic needs Python 3.10 or newer.
|