@hookform/resolvers 5.4.2 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/arktype/src/__tests__/__snapshots__/arktype.ts.snap +11 -11
  2. package/arktype/src/__tests__/arktype.ts +15 -6
  3. package/computed-types/src/__tests__/computed-types.ts +15 -6
  4. package/effect-ts/src/__tests__/effect-ts.ts +15 -6
  5. package/io-ts/src/__tests__/io-ts.ts +15 -6
  6. package/package.json +1 -1
  7. package/standard-schema/src/__tests__/__snapshots__/standard-schema.ts.snap +31 -0
  8. package/standard-schema/src/__tests__/standard-schema.ts +21 -13
  9. package/superstruct/dist/superstruct.d.ts +5 -0
  10. package/superstruct/dist/superstruct.js.map +1 -1
  11. package/superstruct/dist/superstruct.modern.mjs.map +1 -1
  12. package/superstruct/dist/superstruct.module.js.map +1 -1
  13. package/superstruct/dist/superstruct.umd.js.map +1 -1
  14. package/superstruct/src/__tests__/superstruct.ts +22 -8
  15. package/superstruct/src/superstruct.ts +13 -0
  16. package/typanion/src/__tests__/typanion.ts +8 -3
  17. package/typebox/src/__tests__/typebox.ts +31 -18
  18. package/typeschema/dist/typeschema.js +1 -1
  19. package/typeschema/dist/typeschema.js.map +1 -1
  20. package/typeschema/dist/typeschema.mjs +1 -1
  21. package/typeschema/dist/typeschema.modern.mjs +1 -1
  22. package/typeschema/dist/typeschema.modern.mjs.map +1 -1
  23. package/typeschema/dist/typeschema.module.js +1 -1
  24. package/typeschema/dist/typeschema.module.js.map +1 -1
  25. package/typeschema/dist/typeschema.umd.js +1 -1
  26. package/typeschema/dist/typeschema.umd.js.map +1 -1
  27. package/typeschema/src/__tests__/typeschema.ts +23 -15
  28. package/typeschema/src/typeschema.ts +6 -6
  29. package/valibot/src/__tests__/valibot.ts +15 -6
  30. package/vine/src/__tests__/vine.ts +15 -6
  31. package/yup/dist/yup.js.map +1 -1
  32. package/yup/dist/yup.modern.mjs.map +1 -1
  33. package/yup/dist/yup.module.js.map +1 -1
  34. package/yup/dist/yup.umd.js.map +1 -1
  35. package/yup/src/__tests__/yup.ts +15 -6
  36. package/yup/src/yup.ts +10 -2
  37. package/zod/dist/zod.js +1 -1
  38. package/zod/dist/zod.js.map +1 -1
  39. package/zod/dist/zod.mjs +1 -1
  40. package/zod/dist/zod.modern.mjs +1 -1
  41. package/zod/dist/zod.modern.mjs.map +1 -1
  42. package/zod/dist/zod.module.js +1 -1
  43. package/zod/dist/zod.module.js.map +1 -1
  44. package/zod/dist/zod.umd.js +1 -1
  45. package/zod/dist/zod.umd.js.map +1 -1
  46. package/zod/src/__tests__/__snapshots__/zod-v3.ts.snap +430 -0
  47. package/zod/src/__tests__/__snapshots__/zod-v4-mini.ts.snap +472 -0
  48. package/zod/src/__tests__/__snapshots__/zod-v4.ts.snap +434 -0
  49. package/zod/src/__tests__/zod-v3.ts +45 -6
  50. package/zod/src/__tests__/zod-v4-mini.ts +21 -11
  51. package/zod/src/__tests__/zod-v4.ts +47 -11
  52. package/zod/src/zod.ts +15 -2
@@ -0,0 +1,472 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`zodResolver > should return a single error from zodResolver when validation fails 1`] = `
4
+ {
5
+ "errors": {
6
+ "accessToken": {
7
+ "message": "Invalid input",
8
+ "ref": undefined,
9
+ "type": "invalid_type",
10
+ },
11
+ "auth": {
12
+ "type": {
13
+ "message": "Invalid input",
14
+ "ref": undefined,
15
+ "type": "invalid_union",
16
+ },
17
+ },
18
+ "birthYear": {
19
+ "message": "Invalid input",
20
+ "ref": undefined,
21
+ "type": "invalid_type",
22
+ },
23
+ "dateStr": {
24
+ "message": "Invalid input",
25
+ "ref": undefined,
26
+ "type": "invalid_type",
27
+ },
28
+ "email": {
29
+ "message": "Invalid input",
30
+ "ref": {
31
+ "name": "email",
32
+ },
33
+ "type": "invalid_format",
34
+ },
35
+ "enabled": {
36
+ "message": "Invalid input",
37
+ "ref": undefined,
38
+ "type": "invalid_type",
39
+ },
40
+ "like": [
41
+ {
42
+ "id": {
43
+ "message": "Invalid input",
44
+ "ref": undefined,
45
+ "type": "invalid_type",
46
+ },
47
+ "name": {
48
+ "message": "Invalid input",
49
+ "ref": undefined,
50
+ "type": "invalid_type",
51
+ },
52
+ },
53
+ ],
54
+ "password": {
55
+ "message": "One uppercase character",
56
+ "ref": {
57
+ "name": "password",
58
+ },
59
+ "type": "invalid_format",
60
+ },
61
+ "repeatPassword": {
62
+ "message": "Invalid input",
63
+ "ref": undefined,
64
+ "type": "invalid_type",
65
+ },
66
+ "tags": {
67
+ "message": "Invalid input",
68
+ "ref": undefined,
69
+ "type": "invalid_type",
70
+ },
71
+ "url": {
72
+ "message": "Custom error url",
73
+ "ref": undefined,
74
+ "type": "invalid_format",
75
+ },
76
+ "username": {
77
+ "message": "Invalid input",
78
+ "ref": {
79
+ "name": "username",
80
+ },
81
+ "type": "invalid_type",
82
+ },
83
+ },
84
+ "values": {},
85
+ }
86
+ `;
87
+
88
+ exports[`zodResolver > should return a single error from zodResolver with \`mode: sync\` when validation fails 1`] = `
89
+ {
90
+ "errors": {
91
+ "accessToken": {
92
+ "message": "Invalid input",
93
+ "ref": undefined,
94
+ "type": "invalid_type",
95
+ },
96
+ "auth": {
97
+ "type": {
98
+ "message": "Invalid input",
99
+ "ref": undefined,
100
+ "type": "invalid_union",
101
+ },
102
+ },
103
+ "birthYear": {
104
+ "message": "Invalid input",
105
+ "ref": undefined,
106
+ "type": "invalid_type",
107
+ },
108
+ "dateStr": {
109
+ "message": "Invalid input",
110
+ "ref": undefined,
111
+ "type": "invalid_type",
112
+ },
113
+ "email": {
114
+ "message": "Invalid input",
115
+ "ref": {
116
+ "name": "email",
117
+ },
118
+ "type": "invalid_format",
119
+ },
120
+ "enabled": {
121
+ "message": "Invalid input",
122
+ "ref": undefined,
123
+ "type": "invalid_type",
124
+ },
125
+ "like": [
126
+ {
127
+ "id": {
128
+ "message": "Invalid input",
129
+ "ref": undefined,
130
+ "type": "invalid_type",
131
+ },
132
+ "name": {
133
+ "message": "Invalid input",
134
+ "ref": undefined,
135
+ "type": "invalid_type",
136
+ },
137
+ },
138
+ ],
139
+ "password": {
140
+ "message": "One uppercase character",
141
+ "ref": {
142
+ "name": "password",
143
+ },
144
+ "type": "invalid_format",
145
+ },
146
+ "repeatPassword": {
147
+ "message": "Invalid input",
148
+ "ref": undefined,
149
+ "type": "invalid_type",
150
+ },
151
+ "tags": {
152
+ "message": "Invalid input",
153
+ "ref": undefined,
154
+ "type": "invalid_type",
155
+ },
156
+ "url": {
157
+ "message": "Custom error url",
158
+ "ref": undefined,
159
+ "type": "invalid_format",
160
+ },
161
+ "username": {
162
+ "message": "Invalid input",
163
+ "ref": {
164
+ "name": "username",
165
+ },
166
+ "type": "invalid_type",
167
+ },
168
+ },
169
+ "values": {},
170
+ }
171
+ `;
172
+
173
+ exports[`zodResolver > should return all the errors from zodResolver when validation fails with \`validateAllFieldCriteria\` set to true 1`] = `
174
+ {
175
+ "errors": {
176
+ "accessToken": {
177
+ "message": "Invalid input",
178
+ "ref": undefined,
179
+ "type": "invalid_type",
180
+ "types": {
181
+ "invalid_type": [
182
+ "Invalid input",
183
+ "Invalid input",
184
+ ],
185
+ "invalid_union": "Invalid input",
186
+ },
187
+ },
188
+ "auth": {
189
+ "type": {
190
+ "message": "Invalid input",
191
+ "ref": undefined,
192
+ "type": "invalid_union",
193
+ "types": {
194
+ "invalid_union": "Invalid input",
195
+ },
196
+ },
197
+ },
198
+ "birthYear": {
199
+ "message": "Invalid input",
200
+ "ref": undefined,
201
+ "type": "invalid_type",
202
+ "types": {
203
+ "invalid_type": "Invalid input",
204
+ },
205
+ },
206
+ "dateStr": {
207
+ "message": "Invalid input",
208
+ "ref": undefined,
209
+ "type": "invalid_type",
210
+ "types": {
211
+ "invalid_type": "Invalid input",
212
+ },
213
+ },
214
+ "email": {
215
+ "message": "Invalid input",
216
+ "ref": {
217
+ "name": "email",
218
+ },
219
+ "type": "invalid_format",
220
+ "types": {
221
+ "invalid_format": "Invalid input",
222
+ },
223
+ },
224
+ "enabled": {
225
+ "message": "Invalid input",
226
+ "ref": undefined,
227
+ "type": "invalid_type",
228
+ "types": {
229
+ "invalid_type": "Invalid input",
230
+ },
231
+ },
232
+ "like": [
233
+ {
234
+ "id": {
235
+ "message": "Invalid input",
236
+ "ref": undefined,
237
+ "type": "invalid_type",
238
+ "types": {
239
+ "invalid_type": "Invalid input",
240
+ },
241
+ },
242
+ "name": {
243
+ "message": "Invalid input",
244
+ "ref": undefined,
245
+ "type": "invalid_type",
246
+ "types": {
247
+ "invalid_type": "Invalid input",
248
+ },
249
+ },
250
+ },
251
+ ],
252
+ "password": {
253
+ "message": "One uppercase character",
254
+ "ref": {
255
+ "name": "password",
256
+ },
257
+ "type": "invalid_format",
258
+ "types": {
259
+ "invalid_format": [
260
+ "One uppercase character",
261
+ "One lowercase character",
262
+ "One number",
263
+ ],
264
+ "too_small": "Must be at least 8 characters in length",
265
+ },
266
+ },
267
+ "repeatPassword": {
268
+ "message": "Invalid input",
269
+ "ref": undefined,
270
+ "type": "invalid_type",
271
+ "types": {
272
+ "invalid_type": "Invalid input",
273
+ },
274
+ },
275
+ "tags": {
276
+ "message": "Invalid input",
277
+ "ref": undefined,
278
+ "type": "invalid_type",
279
+ "types": {
280
+ "invalid_type": "Invalid input",
281
+ },
282
+ },
283
+ "url": {
284
+ "message": "Custom error url",
285
+ "ref": undefined,
286
+ "type": "invalid_format",
287
+ "types": {
288
+ "invalid_format": "Custom error url",
289
+ "invalid_union": "Invalid input",
290
+ "invalid_value": "Invalid input",
291
+ },
292
+ },
293
+ "username": {
294
+ "message": "Invalid input",
295
+ "ref": {
296
+ "name": "username",
297
+ },
298
+ "type": "invalid_type",
299
+ "types": {
300
+ "invalid_type": "Invalid input",
301
+ },
302
+ },
303
+ },
304
+ "values": {},
305
+ }
306
+ `;
307
+
308
+ exports[`zodResolver > should return all the errors from zodResolver when validation fails with \`validateAllFieldCriteria\` set to true and \`mode: sync\` 1`] = `
309
+ {
310
+ "errors": {
311
+ "accessToken": {
312
+ "message": "Invalid input",
313
+ "ref": undefined,
314
+ "type": "invalid_type",
315
+ "types": {
316
+ "invalid_type": [
317
+ "Invalid input",
318
+ "Invalid input",
319
+ ],
320
+ "invalid_union": "Invalid input",
321
+ },
322
+ },
323
+ "auth": {
324
+ "type": {
325
+ "message": "Invalid input",
326
+ "ref": undefined,
327
+ "type": "invalid_union",
328
+ "types": {
329
+ "invalid_union": "Invalid input",
330
+ },
331
+ },
332
+ },
333
+ "birthYear": {
334
+ "message": "Invalid input",
335
+ "ref": undefined,
336
+ "type": "invalid_type",
337
+ "types": {
338
+ "invalid_type": "Invalid input",
339
+ },
340
+ },
341
+ "dateStr": {
342
+ "message": "Invalid input",
343
+ "ref": undefined,
344
+ "type": "invalid_type",
345
+ "types": {
346
+ "invalid_type": "Invalid input",
347
+ },
348
+ },
349
+ "email": {
350
+ "message": "Invalid input",
351
+ "ref": {
352
+ "name": "email",
353
+ },
354
+ "type": "invalid_format",
355
+ "types": {
356
+ "invalid_format": "Invalid input",
357
+ },
358
+ },
359
+ "enabled": {
360
+ "message": "Invalid input",
361
+ "ref": undefined,
362
+ "type": "invalid_type",
363
+ "types": {
364
+ "invalid_type": "Invalid input",
365
+ },
366
+ },
367
+ "like": [
368
+ {
369
+ "id": {
370
+ "message": "Invalid input",
371
+ "ref": undefined,
372
+ "type": "invalid_type",
373
+ "types": {
374
+ "invalid_type": "Invalid input",
375
+ },
376
+ },
377
+ "name": {
378
+ "message": "Invalid input",
379
+ "ref": undefined,
380
+ "type": "invalid_type",
381
+ "types": {
382
+ "invalid_type": "Invalid input",
383
+ },
384
+ },
385
+ },
386
+ ],
387
+ "password": {
388
+ "message": "One uppercase character",
389
+ "ref": {
390
+ "name": "password",
391
+ },
392
+ "type": "invalid_format",
393
+ "types": {
394
+ "invalid_format": [
395
+ "One uppercase character",
396
+ "One lowercase character",
397
+ "One number",
398
+ ],
399
+ "too_small": "Must be at least 8 characters in length",
400
+ },
401
+ },
402
+ "repeatPassword": {
403
+ "message": "Invalid input",
404
+ "ref": undefined,
405
+ "type": "invalid_type",
406
+ "types": {
407
+ "invalid_type": "Invalid input",
408
+ },
409
+ },
410
+ "tags": {
411
+ "message": "Invalid input",
412
+ "ref": undefined,
413
+ "type": "invalid_type",
414
+ "types": {
415
+ "invalid_type": "Invalid input",
416
+ },
417
+ },
418
+ "url": {
419
+ "message": "Custom error url",
420
+ "ref": undefined,
421
+ "type": "invalid_format",
422
+ "types": {
423
+ "invalid_format": "Custom error url",
424
+ "invalid_union": "Invalid input",
425
+ "invalid_value": "Invalid input",
426
+ },
427
+ },
428
+ "username": {
429
+ "message": "Invalid input",
430
+ "ref": {
431
+ "name": "username",
432
+ },
433
+ "type": "invalid_type",
434
+ "types": {
435
+ "invalid_type": "Invalid input",
436
+ },
437
+ },
438
+ },
439
+ "values": {},
440
+ }
441
+ `;
442
+
443
+ exports[`zodResolver > should return parsed values from zodResolver with \`mode: sync\` when validation pass 1`] = `
444
+ {
445
+ "errors": {},
446
+ "values": {
447
+ "accessToken": "accessToken",
448
+ "auth": {
449
+ "passwordHash": "hash",
450
+ "type": "registered",
451
+ },
452
+ "birthYear": 2000,
453
+ "dateStr": 2020-01-01T00:00:00.000Z,
454
+ "email": "john@doe.com",
455
+ "enabled": true,
456
+ "like": [
457
+ {
458
+ "id": 1,
459
+ "name": "name",
460
+ },
461
+ ],
462
+ "password": "Password123_",
463
+ "repeatPassword": "Password123_",
464
+ "tags": [
465
+ "tag1",
466
+ "tag2",
467
+ ],
468
+ "url": "https://react-hook-form.com/",
469
+ "username": "Doe",
470
+ },
471
+ }
472
+ `;