Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita7cb6ed

Browse files
authored
fix(v4): add exact to length check issue (#4617)
* fix(v4): add exact to length check issue* feat(v4): update error messages for english(en) and german(de) to reflect the new exact issue property, adjust test accordingly* Revert "feat(v4): update error messages for english(en) and german(de) to reflect the new exact issue property, adjust test accordingly"This reverts commita17a0a0.
1 parent218a267 commita7cb6ed

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

‎packages/zod/src/v4/classic/tests/array.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ test("array length", async () => {
4949
[
5050
{
5151
"code": "too_small",
52+
"exact": true,
5253
"message": "Too small: expected array to have >2 items",
5354
"minimum": 2,
5455
"origin": "array",
@@ -63,6 +64,7 @@ test("array length", async () => {
6364
[
6465
{
6566
"code": "too_big",
67+
"exact": true,
6668
"maximum": 2,
6769
"message": "Too big: expected array to have <2 items",
6870
"origin": "array",

‎packages/zod/src/v4/classic/tests/validations.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ test("string length", async () => {
1111
[
1212
{
1313
"code": "too_small",
14+
"exact": true,
1415
"message": "Too small: expected string to have >4 characters",
1516
"minimum": 4,
1617
"origin": "string",
@@ -28,6 +29,7 @@ test("string length", async () => {
2829
[
2930
{
3031
"code": "too_big",
32+
"exact": true,
3133
"maximum": 4,
3234
"message": "Too big: expected string to have <4 characters",
3335
"origin": "string",

‎packages/zod/src/v4/core/checks.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,9 @@ export const $ZodCheckLengthEquals: core.$constructor<$ZodCheckLengthEquals> = /
725725
consttooBig=length>def.length;
726726
payload.issues.push({
727727
origin,
728-
...(tooBig ?{code:"too_big",maximum:def.length} :{code:"too_small",minimum:def.length}),
728+
...(tooBig
729+
?{code:"too_big",maximum:def.length,exact:true}
730+
:{code:"too_small",minimum:def.length,exact:true}),
729731
input:payload.value,
730732
inst,
731733
continue:!def.abort,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp