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

feat: Allow passing custom message to literal #2978

Conversation

LiamMartens
Copy link

Fixes #2974

Uses a message key instead of "invalid_xx" key - because those are only used for required and invalid type using a message key is more in line with other checks

Copy link

netlify bot commented Nov 18, 2023

Deploy Preview for guileless-rolypoly-866f8a ready!

Name Link
🔨 Latest commit 1cff799
🔍 Latest deploy log https://app.netlify.com/sites/guileless-rolypoly-866f8a/deploys/662c44ba72dd620008df1678
😎 Deploy Preview https://deploy-preview-2978--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.

@colinhacks
Copy link
Owner

Thanks for this! Error customization is going to be a lot better in Zod 4. I'll merge this but it'll likely undergo some changes before being released.

Fixes colinhacks#2974

Uses a message key instead of "invalid_xx" key - because those are only used for required and invalid type
using a message key is more in line with other checks
@colinhacks colinhacks force-pushed the feat/allow-passing-custom-message-to-literal-check branch from 41ce771 to 1cff799 Compare April 27, 2024 00:20
@colinhacks colinhacks changed the base branch from master to v4 April 27, 2024 00:20
@colinhacks colinhacks merged commit 999c8c1 into colinhacks:v4 Apr 27, 2024
colinhacks added a commit to ytsunekawa/zod that referenced this pull request May 3, 2024
* feat: Allow passing custom message to literal
Fixes colinhacks#2974

Uses a message key instead of "invalid_xx" key - because those are only used for required and invalid type
using a message key is more in line with other checks

* Remove lib

---------

Co-authored-by: Colin McDonnell <[email protected]>
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.

Custom error messages don't work with z.literal
2 participants