Skip to content

refactor(api): replace class-validator with zod - #1190

Open
ugcodrr wants to merge 3 commits into
refactor/enums-to-constfrom
refactor/api-zod
Open

ugcodrr wants to merge 3 commits into
refactor/enums-to-constfrom
refactor/api-zod

Conversation

@ugcodrr

@ugcodrr ugcodrr commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Description: Jake wanted class-validator and class-transformer swapped for Zod, with Nest staying for now. Requests, defaults and coercion work the same, and the docs page only gains a number type on size for /skin/head.

  1. 400s keep the same message, error and statusCode body, but the messages are Zod's now.
  2. A non-object theme or footer on PATCH /user and a single string for fields on the rankings endpoints now get a 400, where they used to save junk or throw a 500.

Testing: 171 requests (everything the bots and site send, plus edge cases) through the old and new pipes give the same results apart from the two above and junk like page=1e21, and GET /player returns a 400 with "player: Invalid input: expected string, received undefined".

Depends on #1189

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
statsify Ignored Ignored Nov 11, 2026 4:14am UTC

@jacobk999 jacobk999 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably just use https://www.npmjs.com/package/nestjs-zod since it will also handle metadata for OpenAPI spec.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants