@forklaunch/validator 0.3.13 → 0.4.1

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 (74) hide show
  1. package/lib/index.d.mts +17 -0
  2. package/lib/index.d.ts +17 -2
  3. package/lib/index.js +44 -1
  4. package/lib/index.mjs +17 -0
  5. package/lib/schema.types-Do9dhcdB.d.mts +476 -0
  6. package/lib/schema.types-Do9dhcdB.d.ts +476 -0
  7. package/lib/src/typebox/index.d.mts +213 -0
  8. package/lib/src/typebox/index.d.ts +213 -3
  9. package/lib/src/typebox/index.js +435 -1
  10. package/lib/src/typebox/index.mjs +393 -0
  11. package/lib/src/zod/index.d.mts +106 -0
  12. package/lib/src/zod/index.d.ts +106 -3
  13. package/lib/src/zod/index.js +289 -1
  14. package/lib/src/zod/index.mjs +242 -0
  15. package/lib/tests/utils/mockSchemaValidator.d.mts +69 -0
  16. package/lib/tests/utils/mockSchemaValidator.d.ts +29 -25
  17. package/lib/tests/utils/mockSchemaValidator.js +143 -79
  18. package/lib/tests/utils/mockSchemaValidator.mjs +99 -0
  19. package/package.json +48 -35
  20. package/lib/index.d.ts.map +0 -1
  21. package/lib/src/shared/types/schema.types.d.ts +0 -255
  22. package/lib/src/shared/types/schema.types.d.ts.map +0 -1
  23. package/lib/src/shared/types/schema.types.js +0 -1
  24. package/lib/src/typebox/index.d.ts.map +0 -1
  25. package/lib/src/typebox/staticSchemaValidator.d.ts +0 -99
  26. package/lib/src/typebox/staticSchemaValidator.d.ts.map +0 -1
  27. package/lib/src/typebox/staticSchemaValidator.js +0 -99
  28. package/lib/src/typebox/typeboxSchemaValidator.d.ts +0 -122
  29. package/lib/src/typebox/typeboxSchemaValidator.d.ts.map +0 -1
  30. package/lib/src/typebox/typeboxSchemaValidator.js +0 -362
  31. package/lib/src/typebox/types/schema.types.d.ts +0 -59
  32. package/lib/src/typebox/types/schema.types.d.ts.map +0 -1
  33. package/lib/src/typebox/types/schema.types.js +0 -1
  34. package/lib/src/zod/index.d.ts.map +0 -1
  35. package/lib/src/zod/staticSchemaValidator.d.ts +0 -99
  36. package/lib/src/zod/staticSchemaValidator.d.ts.map +0 -1
  37. package/lib/src/zod/staticSchemaValidator.js +0 -99
  38. package/lib/src/zod/types/schema.types.d.ts +0 -71
  39. package/lib/src/zod/types/schema.types.d.ts.map +0 -1
  40. package/lib/src/zod/types/schema.types.js +0 -1
  41. package/lib/src/zod/zodSchemaValidator.d.ts +0 -110
  42. package/lib/src/zod/zodSchemaValidator.d.ts.map +0 -1
  43. package/lib/src/zod/zodSchemaValidator.js +0 -192
  44. package/lib/tests/typebox/advancedParse.test.d.ts +0 -2
  45. package/lib/tests/typebox/advancedParse.test.d.ts.map +0 -1
  46. package/lib/tests/typebox/advancedParse.test.js +0 -514
  47. package/lib/tests/typebox/largeSchema.test.d.ts +0 -2
  48. package/lib/tests/typebox/largeSchema.test.d.ts.map +0 -1
  49. package/lib/tests/typebox/largeSchema.test.js +0 -150
  50. package/lib/tests/typebox/schemaValidator.test.d.ts +0 -2
  51. package/lib/tests/typebox/schemaValidator.test.d.ts.map +0 -1
  52. package/lib/tests/typebox/schemaValidator.test.js +0 -253
  53. package/lib/tests/typebox/typeEquality.test.d.ts +0 -2
  54. package/lib/tests/typebox/typeEquality.test.d.ts.map +0 -1
  55. package/lib/tests/typebox/typeEquality.test.js +0 -100
  56. package/lib/tests/utils/compare.d.ts +0 -2
  57. package/lib/tests/utils/compare.d.ts.map +0 -1
  58. package/lib/tests/utils/compare.js +0 -8
  59. package/lib/tests/utils/mockSchemaValidator.d.ts.map +0 -1
  60. package/lib/tests/zod/advancedParse.test.d.ts +0 -2
  61. package/lib/tests/zod/advancedParse.test.d.ts.map +0 -1
  62. package/lib/tests/zod/advancedParse.test.js +0 -514
  63. package/lib/tests/zod/largeSchema.test.d.ts +0 -2
  64. package/lib/tests/zod/largeSchema.test.d.ts.map +0 -1
  65. package/lib/tests/zod/largeSchema.test.js +0 -150
  66. package/lib/tests/zod/schemaValidator.test.d.ts +0 -2
  67. package/lib/tests/zod/schemaValidator.test.d.ts.map +0 -1
  68. package/lib/tests/zod/schemaValidator.test.js +0 -205
  69. package/lib/tests/zod/typeEquality.test.d.ts +0 -2
  70. package/lib/tests/zod/typeEquality.test.d.ts.map +0 -1
  71. package/lib/tests/zod/typeEquality.test.js +0 -100
  72. package/lib/vitest.config.d.ts +0 -3
  73. package/lib/vitest.config.d.ts.map +0 -1
  74. package/lib/vitest.config.js +0 -7
@@ -1,514 +0,0 @@
1
- import { any, bigint, boolean, date, email, never, nullish, number, SchemaValidator, string, symbol, unknown, uri, uuid } from '../../src/zod';
2
- import { compare } from '../utils/compare';
3
- describe('zod advanced parse', () => {
4
- const schemaValidator = SchemaValidator();
5
- describe('string', () => {
6
- test('valid string', () => {
7
- compare(schemaValidator.parse(string, 'hello'), {
8
- ok: true,
9
- value: 'hello'
10
- });
11
- });
12
- test('invalid string with number', () => {
13
- expect(schemaValidator.parse(string, 123).ok).toBe(false);
14
- });
15
- test('invalid string with boolean', () => {
16
- expect(schemaValidator.parse(string, true).ok).toBe(false);
17
- });
18
- test('invalid string with object', () => {
19
- expect(schemaValidator.parse(string, { hello: 'world' }).ok).toBe(false);
20
- });
21
- test('invalid string with array', () => {
22
- expect(schemaValidator.parse(string, ['hello', 'world']).ok).toBe(false);
23
- });
24
- test('invalid string with null', () => {
25
- expect(schemaValidator.parse(string, null).ok).toBe(false);
26
- });
27
- test('invalid string with undefined', () => {
28
- expect(schemaValidator.parse(string, undefined).ok).toBe(false);
29
- });
30
- test('invalid string with symbol', () => {
31
- expect(schemaValidator.parse(string, Symbol('hello')).ok).toBe(false);
32
- });
33
- test('invalid string with bigint', () => {
34
- expect(schemaValidator.parse(string, BigInt(123)).ok).toBe(false);
35
- });
36
- test('invalid string with date', () => {
37
- expect(schemaValidator.parse(string, new Date()).ok).toBe(false);
38
- });
39
- });
40
- describe('uuid', () => {
41
- test('valid uuid', () => {
42
- compare(schemaValidator.parse(uuid, 'f651c6c5-f628-48de-904c-f37509a97ab6'), {
43
- ok: true,
44
- value: 'f651c6c5-f628-48de-904c-f37509a97ab6'
45
- });
46
- });
47
- test('invalid uuid', () => {
48
- expect(schemaValidator.parse(uuid, 'hello').ok).toBe(false);
49
- });
50
- });
51
- describe('uri', () => {
52
- test('valid uri', () => {
53
- compare(schemaValidator.parse(uri, 'https://forklaunch.com'), {
54
- ok: true,
55
- value: 'https://forklaunch.com'
56
- });
57
- });
58
- test('invalid uri', () => {
59
- expect(schemaValidator.parse(uri, 'hello').ok).toBe(false);
60
- });
61
- });
62
- describe('email', () => {
63
- test('valid email', () => {
64
- compare(schemaValidator.parse(email, 'test@forklaunch.com'), {
65
- ok: true,
66
- value: 'test@forklaunch.com'
67
- });
68
- });
69
- test('invalid email', () => {
70
- expect(schemaValidator.parse(email, 'hello').ok).toBe(false);
71
- });
72
- });
73
- describe('number', () => {
74
- test('valid number', () => {
75
- compare(schemaValidator.parse(number, 123), {
76
- ok: true,
77
- value: 123
78
- });
79
- });
80
- test('valid number with numeric string', () => {
81
- compare(schemaValidator.parse(number, 123), {
82
- ok: true,
83
- value: 123
84
- });
85
- });
86
- test('valid number with boolean', () => {
87
- compare(schemaValidator.parse(number, true), {
88
- ok: true,
89
- value: 1
90
- });
91
- });
92
- test('valid number with null', () => {
93
- compare(schemaValidator.parse(number, null), {
94
- ok: true,
95
- value: 0
96
- });
97
- });
98
- test('valid number with date', () => {
99
- compare(schemaValidator.parse(number, new Date(0)), {
100
- ok: true,
101
- value: 0
102
- });
103
- });
104
- test('valid number with bigint', () => {
105
- compare(schemaValidator.parse(number, BigInt(123)), {
106
- ok: true,
107
- value: 123
108
- });
109
- });
110
- test('invalid number with string', () => {
111
- expect(schemaValidator.parse(number, 'hello').ok).toBe(false);
112
- });
113
- test('invalid number with object', () => {
114
- expect(schemaValidator.parse(number, { hello: 'world' }).ok).toBe(false);
115
- });
116
- test('invalid number with array', () => {
117
- expect(schemaValidator.parse(number, ['hello', 'world']).ok).toBe(false);
118
- });
119
- test('invalid number with undefined', () => {
120
- expect(schemaValidator.parse(number, undefined).ok).toBe(false);
121
- });
122
- test('invalid number with symbol', () => {
123
- expect(schemaValidator.parse(number, Symbol('hello')).ok).toBe(false);
124
- });
125
- });
126
- describe('bigint', () => {
127
- test('valid bigint', () => {
128
- const parsed = schemaValidator.parse(bigint, BigInt('12345678901234567890'));
129
- if (parsed.ok) {
130
- compare(parsed.value, BigInt('12345678901234567890'));
131
- }
132
- else {
133
- fail();
134
- }
135
- });
136
- test('valid bigint with number', () => {
137
- const parsed = schemaValidator.parse(bigint, 123123);
138
- if (parsed.ok) {
139
- compare(parsed.value, BigInt(123123));
140
- }
141
- else {
142
- fail();
143
- }
144
- });
145
- test('valid bigint with boolean', () => {
146
- const parsed = schemaValidator.parse(bigint, true);
147
- if (parsed.ok) {
148
- compare(parsed.value, BigInt(1));
149
- }
150
- else {
151
- fail();
152
- }
153
- });
154
- test('valid bigint with date', () => {
155
- const parsed = schemaValidator.parse(bigint, new Date(0));
156
- if (parsed.ok) {
157
- compare(parsed.value, BigInt(0));
158
- }
159
- else {
160
- fail();
161
- }
162
- });
163
- test('invalid bigint with string', () => {
164
- expect(schemaValidator.parse(bigint, 'hello').ok).toBe(false);
165
- });
166
- test('invalid bigint with object', () => {
167
- expect(schemaValidator.parse(bigint, { hello: 'world' }).ok).toBe(false);
168
- });
169
- test('invalid bigint with array', () => {
170
- expect(schemaValidator.parse(bigint, ['hello', 'world']).ok).toBe(false);
171
- });
172
- test('invalid bigint with null', () => {
173
- expect(schemaValidator.parse(bigint, null).ok).toBe(false);
174
- });
175
- test('invalid bigint with undefined', () => {
176
- expect(schemaValidator.parse(bigint, undefined).ok).toBe(false);
177
- });
178
- test('invalid bigint with symbol', () => {
179
- expect(schemaValidator.parse(bigint, Symbol('hello')).ok).toBe(false);
180
- });
181
- });
182
- describe('boolean', () => {
183
- test('valid boolean', () => {
184
- compare(schemaValidator.parse(boolean, true), {
185
- ok: true,
186
- value: true
187
- });
188
- });
189
- test('valid boolean with boolean string', () => {
190
- compare(schemaValidator.parse(boolean, 'true'), {
191
- ok: true,
192
- value: true
193
- });
194
- });
195
- test('invalid boolean with string', () => {
196
- expect(schemaValidator.parse(boolean, 'hello').ok).toBe(false);
197
- });
198
- test('invalid boolean with number', () => {
199
- expect(schemaValidator.parse(boolean, 123).ok).toBe(false);
200
- });
201
- test('invalid boolean with object', () => {
202
- expect(schemaValidator.parse(boolean, { hello: 'world' }).ok).toBe(false);
203
- });
204
- test('invalid boolean with array', () => {
205
- expect(schemaValidator.parse(boolean, ['hello', 'world']).ok).toBe(false);
206
- });
207
- test('invalid boolean with null', () => {
208
- expect(schemaValidator.parse(boolean, null).ok).toBe(false);
209
- });
210
- test('invalid boolean with undefined', () => {
211
- expect(schemaValidator.parse(boolean, undefined).ok).toBe(false);
212
- });
213
- test('invalid boolean with symbol', () => {
214
- expect(schemaValidator.parse(boolean, Symbol('hello')).ok).toBe(false);
215
- });
216
- test('invalid boolean with bigint', () => {
217
- expect(schemaValidator.parse(boolean, BigInt(123)).ok).toBe(false);
218
- });
219
- test('invalid boolean with date', () => {
220
- expect(schemaValidator.parse(boolean, new Date()).ok).toBe(false);
221
- });
222
- });
223
- describe('date', () => {
224
- test('valid date', () => {
225
- const dateTest = new Date();
226
- compare(schemaValidator.parse(date, dateTest), {
227
- ok: true,
228
- value: dateTest
229
- });
230
- });
231
- test('valid date with datestring', () => {
232
- compare(schemaValidator.parse(date, '2021-01-01'), {
233
- ok: true,
234
- value: new Date('2021-01-01')
235
- });
236
- });
237
- test('valid date with number', () => {
238
- compare(schemaValidator.parse(date, 123), {
239
- ok: true,
240
- value: new Date(123)
241
- });
242
- });
243
- test('valid date with boolean', () => {
244
- compare(schemaValidator.parse(date, true), {
245
- ok: true,
246
- value: new Date(1)
247
- });
248
- });
249
- test('valid date with null', () => {
250
- compare(schemaValidator.parse(date, null), {
251
- ok: true,
252
- value: new Date(0)
253
- });
254
- });
255
- test('invalid date with string', () => {
256
- expect(schemaValidator.parse(date, 'hello').ok).toBe(false);
257
- });
258
- test('invalid date with object', () => {
259
- expect(schemaValidator.parse(date, { hello: 'world' }).ok).toBe(false);
260
- });
261
- test('invalid date with array', () => {
262
- expect(schemaValidator.parse(date, ['hello', 'world']).ok).toBe(false);
263
- });
264
- test('invalid date with undefined', () => {
265
- expect(schemaValidator.parse(date, undefined).ok).toBe(false);
266
- });
267
- test('invalid date with symbol', () => {
268
- expect(schemaValidator.parse(date, Symbol('hello')).ok).toBe(false);
269
- });
270
- test('invalid date with bigint', () => {
271
- expect(schemaValidator.parse(date, BigInt(123)).ok).toBe(false);
272
- });
273
- });
274
- describe('symbol', () => {
275
- test('valid symbol', () => {
276
- const symbolTest = Symbol('hello');
277
- compare(schemaValidator.parse(symbol, symbolTest), {
278
- ok: true,
279
- value: symbolTest
280
- });
281
- });
282
- test('invalid symbol with string', () => {
283
- expect(schemaValidator.parse(symbol, 'hello').ok).toBe(false);
284
- });
285
- test('invalid symbol with number', () => {
286
- expect(schemaValidator.parse(symbol, 123).ok).toBe(false);
287
- });
288
- test('invalid symbol with boolean', () => {
289
- expect(schemaValidator.parse(symbol, true).ok).toBe(false);
290
- });
291
- test('invalid symbol with object', () => {
292
- expect(schemaValidator.parse(symbol, { hello: 'world' }).ok).toBe(false);
293
- });
294
- test('invalid symbol with array', () => {
295
- expect(schemaValidator.parse(symbol, ['hello', 'world']).ok).toBe(false);
296
- });
297
- test('invalid symbol with null', () => {
298
- expect(schemaValidator.parse(symbol, null).ok).toBe(false);
299
- });
300
- test('invalid symbol with undefined', () => {
301
- expect(schemaValidator.parse(symbol, undefined).ok).toBe(false);
302
- });
303
- test('invalid symbol with bigint', () => {
304
- expect(schemaValidator.parse(symbol, BigInt(123)).ok).toBe(false);
305
- });
306
- test('invalid symbol with date', () => {
307
- expect(schemaValidator.parse(symbol, new Date()).ok).toBe(false);
308
- });
309
- });
310
- describe('nullish', () => {
311
- test('valid nullish with null', () => {
312
- compare(schemaValidator.parse(nullish, null), {
313
- ok: true,
314
- value: null
315
- });
316
- });
317
- test('valid nullish with undefined', () => {
318
- compare(schemaValidator.parse(nullish, undefined), {
319
- ok: true,
320
- value: undefined
321
- });
322
- });
323
- test('invalid nullish with string', () => {
324
- expect(schemaValidator.parse(nullish, 'hello').ok).toBe(false);
325
- });
326
- test('invalid nullish with number', () => {
327
- expect(schemaValidator.parse(nullish, 123).ok).toBe(false);
328
- });
329
- test('invalid nullish with boolean', () => {
330
- expect(schemaValidator.parse(nullish, true).ok).toBe(false);
331
- });
332
- test('invalid nullish with object', () => {
333
- expect(schemaValidator.parse(nullish, { hello: 'world' }).ok).toBe(false);
334
- });
335
- test('invalid nullish with array', () => {
336
- expect(schemaValidator.parse(nullish, ['hello', 'world']).ok).toBe(false);
337
- });
338
- test('invalid nullish with symbol', () => {
339
- expect(schemaValidator.parse(nullish, Symbol('hello')).ok).toBe(false);
340
- });
341
- test('invalid nullish with bigint', () => {
342
- expect(schemaValidator.parse(nullish, BigInt(123)).ok).toBe(false);
343
- });
344
- test('invalid nullish with date', () => {
345
- expect(schemaValidator.parse(nullish, new Date()).ok).toBe(false);
346
- });
347
- });
348
- describe('any', () => {
349
- test('valid any with string', () => {
350
- compare(schemaValidator.parse(any, 'hello'), {
351
- ok: true,
352
- value: 'hello'
353
- });
354
- });
355
- test('valid any with number', () => {
356
- compare(schemaValidator.parse(any, 123), {
357
- ok: true,
358
- value: 123
359
- });
360
- });
361
- test('valid any with boolean', () => {
362
- compare(schemaValidator.parse(any, true), {
363
- ok: true,
364
- value: true
365
- });
366
- });
367
- test('valid any with object', () => {
368
- compare(schemaValidator.parse(any, { hello: 'world' }), {
369
- ok: true,
370
- value: { hello: 'world' }
371
- });
372
- });
373
- test('valid any with array', () => {
374
- compare(schemaValidator.parse(any, ['hello', 'world']), {
375
- ok: true,
376
- value: ['hello', 'world']
377
- });
378
- });
379
- test('valid any with null', () => {
380
- compare(schemaValidator.parse(any, null), {
381
- ok: true,
382
- value: null
383
- });
384
- });
385
- test('valid any with undefined', () => {
386
- compare(schemaValidator.parse(any, undefined), {
387
- ok: true,
388
- value: undefined
389
- });
390
- });
391
- test('valid any with symbol', () => {
392
- const symbolTest = Symbol('hello');
393
- compare(schemaValidator.parse(any, symbolTest), {
394
- ok: true,
395
- value: symbolTest
396
- });
397
- });
398
- test('valid any with bigint', () => {
399
- const parsed = schemaValidator.parse(any, BigInt(123));
400
- if (parsed.ok) {
401
- compare(parsed.value, BigInt(123));
402
- }
403
- else {
404
- fail();
405
- }
406
- });
407
- test('valid any with date', () => {
408
- const dateTest = new Date();
409
- compare(schemaValidator.parse(any, dateTest), {
410
- ok: true,
411
- value: dateTest
412
- });
413
- });
414
- });
415
- describe('unknown', () => {
416
- test('valid unknown with string', () => {
417
- compare(schemaValidator.parse(unknown, 'hello'), {
418
- ok: true,
419
- value: 'hello'
420
- });
421
- });
422
- test('valid unknown with number', () => {
423
- compare(schemaValidator.parse(unknown, 123), {
424
- ok: true,
425
- value: 123
426
- });
427
- });
428
- test('valid unknown with boolean', () => {
429
- compare(schemaValidator.parse(unknown, true), {
430
- ok: true,
431
- value: true
432
- });
433
- });
434
- test('valid unknown with object', () => {
435
- compare(schemaValidator.parse(unknown, { hello: 'world' }), {
436
- ok: true,
437
- value: { hello: 'world' }
438
- });
439
- });
440
- test('valid unknown with array', () => {
441
- compare(schemaValidator.parse(unknown, ['hello', 'world']), {
442
- ok: true,
443
- value: ['hello', 'world']
444
- });
445
- });
446
- test('valid unknown with null', () => {
447
- compare(schemaValidator.parse(unknown, null), {
448
- ok: true,
449
- value: null
450
- });
451
- });
452
- test('valid unknown with undefined', () => {
453
- compare(schemaValidator.parse(unknown, undefined), {
454
- ok: true,
455
- value: undefined
456
- });
457
- });
458
- test('valid unknown with symbol', () => {
459
- const symbolTest = Symbol('hello');
460
- compare(schemaValidator.parse(unknown, symbolTest), {
461
- ok: true,
462
- value: symbolTest
463
- });
464
- });
465
- test('valid unknown with bigint', () => {
466
- const parsed = schemaValidator.parse(unknown, BigInt(123));
467
- if (parsed.ok) {
468
- compare(parsed.value, BigInt(123));
469
- }
470
- else {
471
- fail();
472
- }
473
- });
474
- test('valid unknown with date', () => {
475
- const dateTest = new Date();
476
- compare(schemaValidator.parse(unknown, dateTest), {
477
- ok: true,
478
- value: dateTest
479
- });
480
- });
481
- });
482
- describe('never', () => {
483
- test('invalid never with string', () => {
484
- expect(schemaValidator.parse(never, 'hello').ok).toBe(false);
485
- });
486
- test('invalid never with number', () => {
487
- expect(schemaValidator.parse(never, 123).ok).toBe(false);
488
- });
489
- test('invalid never with boolean', () => {
490
- expect(schemaValidator.parse(never, true).ok).toBe(false);
491
- });
492
- test('invalid never with object', () => {
493
- expect(schemaValidator.parse(never, { hello: 'world' }).ok).toBe(false);
494
- });
495
- test('invalid never with array', () => {
496
- expect(schemaValidator.parse(never, ['hello', 'world']).ok).toBe(false);
497
- });
498
- test('invalid never with null', () => {
499
- expect(schemaValidator.parse(never, null).ok).toBe(false);
500
- });
501
- test('invalid never with undefined', () => {
502
- expect(schemaValidator.parse(never, undefined).ok).toBe(false);
503
- });
504
- test('invalid never with symbol', () => {
505
- expect(schemaValidator.parse(never, Symbol('hello')).ok).toBe(false);
506
- });
507
- test('invalid never with bigint', () => {
508
- expect(schemaValidator.parse(never, BigInt(123)).ok).toBe(false);
509
- });
510
- test('invalid never with date', () => {
511
- expect(schemaValidator.parse(never, new Date()).ok).toBe(false);
512
- });
513
- });
514
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=largeSchema.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"largeSchema.test.d.ts","sourceRoot":"","sources":["../../../tests/zod/largeSchema.test.ts"],"names":[],"mappings":""}
@@ -1,150 +0,0 @@
1
- import { array, bigint, boolean, date, never, nullish, number, optional, string, symbol, union } from '../../src/zod/staticSchemaValidator';
2
- describe('Zod Large Schema Tests', () => {
3
- it('Deep Union', async () => {
4
- const deepOne = {
5
- s: {
6
- s: {
7
- s: {
8
- s: {
9
- s: {
10
- s: {
11
- s: {
12
- s: {
13
- s: {
14
- s: {
15
- s: {
16
- s: {
17
- s: {
18
- s: {
19
- b: 'number'
20
- }
21
- }
22
- }
23
- }
24
- }
25
- }
26
- }
27
- }
28
- }
29
- }
30
- }
31
- }
32
- }
33
- }
34
- };
35
- const deepTwo = {
36
- k: {
37
- o: number,
38
- s: {
39
- s: {
40
- s: {
41
- s: {
42
- s: {
43
- s: {
44
- s: {
45
- s: {
46
- s: {
47
- s: {
48
- s: {
49
- s: {
50
- s: {
51
- b: string
52
- }
53
- }
54
- }
55
- }
56
- }
57
- }
58
- }
59
- }
60
- }
61
- }
62
- }
63
- }
64
- }
65
- }
66
- };
67
- const deepUnion = union([deepOne, deepTwo]);
68
- });
69
- it('Realistic Schema', async () => {
70
- const realistic = array({
71
- level1: {
72
- name: {
73
- j: union([
74
- string,
75
- number,
76
- date,
77
- boolean,
78
- bigint,
79
- nullish,
80
- symbol,
81
- never
82
- ]),
83
- t: optional(union([
84
- array({
85
- y: array(number)
86
- }),
87
- string
88
- ])),
89
- m: {
90
- a: optional(string),
91
- b: number,
92
- c: {
93
- d: string,
94
- e: number,
95
- f: {
96
- g: string,
97
- h: number,
98
- i: {
99
- j: string,
100
- k: number,
101
- l: {
102
- m: boolean,
103
- n: array(string),
104
- o: optional(union([string, number])),
105
- p: {
106
- q: string,
107
- r: number
108
- }
109
- }
110
- }
111
- }
112
- }
113
- }
114
- },
115
- additionalField1: {
116
- a: union([string, boolean, bigint, nullish]),
117
- b: optional(array(number)),
118
- c: {
119
- d: string,
120
- e: number,
121
- f: {
122
- g: string,
123
- h: number
124
- }
125
- }
126
- },
127
- additionalField2: {
128
- x: string,
129
- y: union([string, array(boolean)]),
130
- z: {
131
- a: string,
132
- b: number
133
- }
134
- }
135
- },
136
- code: {
137
- 200: {
138
- j: string
139
- },
140
- 404: {
141
- k: string
142
- }
143
- },
144
- flag: {
145
- a: true,
146
- b: false
147
- }
148
- });
149
- });
150
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=schemaValidator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaValidator.test.d.ts","sourceRoot":"","sources":["../../../tests/zod/schemaValidator.test.ts"],"names":[],"mappings":""}