Skip to content

fix: correct invalid Zod email validation in auth router#352

Open
sahilcommit wants to merge 1 commit intoapsinghdev:mainfrom
sahilcommit:fix/zod-email-validation
Open

fix: correct invalid Zod email validation in auth router#352
sahilcommit wants to merge 1 commit intoapsinghdev:mainfrom
sahilcommit:fix/zod-email-validation

Conversation

@sahilcommit
Copy link

@sahilcommit sahilcommit commented Mar 21, 2026

Problem:
The email field in the Google authentication schema is defined using z.email(), which is not a valid Zod API and may lead to incorrect validation behavior.
z.email() is not part of Zod API

Solution:
Replaced the incorrect usage with:
z.string().email("Invalid email format")

Impact:
Ensures correct email validation
Prevents potential runtime issues
Aligns with Zod best practices

Scope:
This is a minimal and isolated fix.

Summary by CodeRabbit

  • Refactor
    • Improved email validation logic in authentication handling.

@vercel
Copy link

vercel bot commented Mar 21, 2026

@sahilcommit is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

📝 Walkthrough

Walkthrough

The googleAuthSchema input validation was updated to use z.string().email() instead of z.email() for the email field. Both approaches perform the same email format validation; the change reflects a different Zod schema API usage pattern while maintaining the identical error message.

Changes

Cohort / File(s) Summary
Email Validation Schema
apps/api/src/routers/auth.ts
Updated googleAuthSchema email field validation from z.email() to z.string().email() with no functional impact on validation behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tiny tweak, so small and neat,
From z.email() to string complete,
Email validation stays just right,
With clarity now shining bright! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately describes the main change: fixing invalid Zod email validation in the auth router, which matches the changeset that updates googleAuthSchema's email field validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

Migrating from UI to YAML configuration.

Use the @coderabbitai configuration command in a PR comment to get a dump of all your UI settings in YAML format. You can then edit this YAML file and upload it to the root of your repository to configure CodeRabbit programmatically.

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.

1 participant