Skip to content

fix(v4): reflect inclusive boundaries in minLength/maxLength issue objects #4591

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

Merged
merged 1 commit into from
Jun 3, 2025

Conversation

wancup
Copy link

@wancup wancup commented Jun 1, 2025

This updates the minLength and maxLength errors in v4 to include the inclusive property. Currently, I believe validations like z.string().max() use inclusive boundaries (

if (length <= def.maximum) return;
), but the default error messages do not seem to reflect this behavior.
In v3, validations like z.string().max() also used inclusive boundaries, and the issue objects correctly indicated this.

If this change was intentional as part of the migration to v4, or if I have misunderstood the current behavior, please feel free to close this pull request!

@colinhacks colinhacks merged commit 5fdece9 into colinhacks:main Jun 3, 2025
4 checks passed
@colinhacks
Copy link
Owner

Good catch, thanks!

@wancup wancup deleted the fix-min-max-length-issues branch June 4, 2025 11:02
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.

2 participants