Skip to content

feature: add attribute message to enum validatiion #3169

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

Conversation

fernandollisboa
Copy link
Contributor

Resolves #3146

Make it possible to call enum validation with a custom message using message attribute:

  z.enum(['aaa', 'bbb', 'ccc'], { message: 'custom error message' });

Copy link

netlify bot commented Jan 22, 2024

Deploy Preview for guileless-rolypoly-866f8a ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1e29cea
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/65d443bf97921c0008ca5f4b
😎 Deploy Preview https://deploy-preview-3169--guileless-rolypoly-866f8a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

fernandollisboa and others added 2 commits February 20, 2024 02:58

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@colinhacks
Copy link
Owner

This has landed in Zod 3.23.

https://github.com/colinhacks/zod/releases/tag/v3.23.0

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.

Enum error message cannot be customized
2 participants