Skip to content

migrate Joi schemas and validation utils to Zod#465

Open
CKodidela wants to merge 1 commit intocameri:mainfrom
CKodidela:migrate-joi-to-zod
Open

migrate Joi schemas and validation utils to Zod#465
CKodidela wants to merge 1 commit intocameri:mainfrom
CKodidela:migrate-joi-to-zod

Conversation

@CKodidela
Copy link
Copy Markdown
Contributor

@CKodidela CKodidela commented Apr 12, 2026

Description

Replaces the joi validation library with zod across all schemas and validation utilities.

Changed files:

  • src/schemas/base-schema.ts hex/lowercase via regex, integer checks via .int(), custom createdAt via
    .refine(), tagSchema using z.tuple().rest()
  • src/schemas/event-schema.ts z.object().strict() replaces .unknown(false)
  • src/schemas/filter-schema.ts .catchall() + .superRefine() handle dynamic #[a-z] tag filter keys
  • src/schemas/message-schema.ts z.union() replaces alternatives().conditional(); z.tuple().rest() with
    superRefine for REQ bounds
  • src/utils/validation.ts validateSchema/attemptValidation rewritten against Zod API
  • src/adapters/web-socket-adapter.ts error name check updated from ValidationError to ZodError

Related Issue

Closes #455

Motivation and Context

joi is a large runtime dependency. zod provides equivalent validation with a TypeScript-first design, better type
inference, and a smaller footprint. All existing validation behaviour is preserved.

How Has This Been Tested?

All existing unit tests pass (381 passing) after updating schema spec files to work with Zod's error format. The 2
pre-existing failures in settings.spec.ts are unrelated Windows path separator issues.

Types of changes

  • Non-functional change (docs, style, minor refactor)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Joi schemas and associated types to Zod

1 participant