Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problematic Zod schema #4413

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

avanderbergh
Copy link

Fixes #4157

In the case where a min check exists on a Number type, we use that value instead of 0.

Copy link

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bugs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2024 2:30pm
remotion ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 18, 2024 2:30pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
remotion-convert ⬜️ Skipped (Inspect) Oct 18, 2024 2:30pm

Comment on lines +20 to +22
return (
(def as z.ZodNumberDef).checks.find((c) => c.kind === 'min')?.value ?? 0
);
Copy link
Author

Choose a reason for hiding this comment

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

@JonnyBurger This fixes this particular issue with the min() or gte(). Would it make sense to also cover other checks like gt() and positive(), multipleOf(), etc...?

And then would it make sense to also extend the same method to other types like string and BigInt for example?

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.

Problematic Zod schema
1 participant