Skip to content

refactor: migrate validation from Joi to Zod#484

Merged
cameri merged 1 commit intocameri:mainfrom
CKodidela:migrate-joi-to-zod-v2
Apr 18, 2026
Merged

refactor: migrate validation from Joi to Zod#484
cameri merged 1 commit intocameri:mainfrom
CKodidela:migrate-joi-to-zod-v2

Conversation

@CKodidela
Copy link
Copy Markdown
Collaborator

@CKodidela CKodidela commented Apr 18, 2026

Description

Replaces joi with zod for all schema validation across the codebase. All schemas (base, event, filter, message, and all four payment callback schemas) have been rewritten using Zod's API. The validateSchema utility now uses safeParse instead of a try/catch cast, and the WebSocket adapter uses instanceof ZodError for proper error detection. Client-facing validation error notices are trimmed to the first issue message to avoid sending verbose Zod output.

Related Issue

Closes #455

Motivation and Context

joi was the previous validation library. This migration moves the project to zod, which has first-class TypeScript support, a cleaner API, and better type inference. The joi dependency has been removed from package.json.

How Has This Been Tested?

  • All unit tests pass locally (540 passing, 0 failing) via npm run test:unit
  • npm run build:check passes with no TypeScript errors
  • npm run lint passes with no ESLint errors
  • Tested on Node.js via WSL (Ubuntu) and Windows

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 read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

@CKodidela
Copy link
Copy Markdown
Collaborator Author

@cameri it should work now, can you run checks

@cameri cameri merged commit 2293dcf into cameri:main Apr 18, 2026
9 checks passed
@cameri cameri self-assigned this Apr 18, 2026
@CKodidela CKodidela deleted the migrate-joi-to-zod-v2 branch April 18, 2026 12:44
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

2 participants