Skip to content

Upgrade from Zod v3.22.4 to Zod v4.x #1864

@solovevayaroslavna

Description

@solovevayaroslavna

Task Description

Upgrade from Zod v3.22.4 to Zod v4.x to unlock the when parameter feature, which will allow CEL validation to run independently of basic field validations.

CEL validation only runs if all basic field validations pass first. This is because CEL expressions are evaluated in Zod's superRefine, which only executes after all basic schema validations (required, min, max, etc.) succeed. If ANY field in the form has a basic validation error (e.g., a required field is empty), CEL validation will not run at all

Reasoning / Benefit

  • CEL validation improvement: Remove requirement for all fields to have default values
  • Performance: 6.5x faster object parsing, 14x faster string parsing
  • Bundle size: 2x reduction in core bundle size
  • TypeScript: 100x reduction in type instantiations
  • New features: Template literals, file schemas, better error handling

Additional Context

Breaking Changes

  • Error Customization API Changes
  • Type Definition Changes
  • String Format Methods Deprecated
  • Refinement Storage Changes

Metadata

Metadata

Labels

choreFor tasks that don't affect the end-user directly.dependenciesPull requests that update a dependency fileuiRequests related to the UI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions