@kubb/plugin-zod 4.10.1 → 4.11.0
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.
- package/dist/{components-BCKi8Hou.js → components-B9udp6Zi.js} +247 -200
- package/dist/components-B9udp6Zi.js.map +1 -0
- package/dist/{components-CwZBp5_M.cjs → components-DaK9uYjS.cjs} +246 -199
- package/dist/components-DaK9uYjS.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-CCF0NvKr.cjs → generators-CDPXFoZT.cjs} +2 -2
- package/dist/{generators-CCF0NvKr.cjs.map → generators-CDPXFoZT.cjs.map} +1 -1
- package/dist/{generators-uL_Da-pi.js → generators-DKQPsBns.js} +2 -2
- package/dist/{generators-uL_Da-pi.js.map → generators-DKQPsBns.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/src/parser.ts +339 -300
- package/dist/components-BCKi8Hou.js.map +0 -1
- package/dist/components-CwZBp5_M.cjs.map +0 -1
|
@@ -258,6 +258,8 @@ const zodKeywordMapper = {
|
|
|
258
258
|
default: (value, innerSchema, mini) => {
|
|
259
259
|
if (mini && innerSchema) return `z._default(${innerSchema}, ${typeof value === "object" ? "{}" : value ?? ""})`;
|
|
260
260
|
if (typeof value === "object") return ".default({})";
|
|
261
|
+
if (value === void 0) return ".default()";
|
|
262
|
+
if (typeof value === "string" && !value) return `.default('')`;
|
|
261
263
|
return `.default(${value ?? ""})`;
|
|
262
264
|
},
|
|
263
265
|
and: (items = [], mini) => {
|
|
@@ -422,226 +424,271 @@ const shouldCoerce = (coercion, type) => {
|
|
|
422
424
|
if (typeof coercion === "boolean") return coercion;
|
|
423
425
|
return !!coercion[type];
|
|
424
426
|
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
schema,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
siblings: siblings$1
|
|
467
|
-
}, options);
|
|
468
|
-
}).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
|
|
469
|
-
if ((0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.enum)) {
|
|
470
|
-
if (current.args.asConst) {
|
|
471
|
-
if (current.args.items.length === 1) {
|
|
472
|
-
const child = {
|
|
473
|
-
keyword: __kubb_plugin_oas.schemaKeywords.const,
|
|
474
|
-
args: current.args.items[0]
|
|
475
|
-
};
|
|
476
|
-
return parse({
|
|
477
|
-
schema,
|
|
478
|
-
parent: current,
|
|
479
|
-
name,
|
|
480
|
-
current: child,
|
|
481
|
-
siblings: [child]
|
|
482
|
-
}, options);
|
|
483
|
-
}
|
|
484
|
-
return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
|
|
485
|
-
keyword: __kubb_plugin_oas.schemaKeywords.const,
|
|
486
|
-
args: schema$1
|
|
487
|
-
})).map((it, _index, siblings$1) => {
|
|
488
|
-
return parse({
|
|
427
|
+
const parse = (0, __kubb_plugin_oas.createParser)({
|
|
428
|
+
mapper: zodKeywordMapper,
|
|
429
|
+
handlers: {
|
|
430
|
+
union(tree, options) {
|
|
431
|
+
const { current, schema, parent, name, siblings } = tree;
|
|
432
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.union)) return void 0;
|
|
433
|
+
if (Array.isArray(current.args) && current.args.length === 1) return this.parse({
|
|
434
|
+
schema,
|
|
435
|
+
parent,
|
|
436
|
+
name,
|
|
437
|
+
current: current.args[0],
|
|
438
|
+
siblings
|
|
439
|
+
}, options);
|
|
440
|
+
if (Array.isArray(current.args) && !current.args.length) return "";
|
|
441
|
+
return zodKeywordMapper.union(sort(current.args).map((it, _index, siblings$1) => this.parse({
|
|
442
|
+
schema,
|
|
443
|
+
parent: current,
|
|
444
|
+
name,
|
|
445
|
+
current: it,
|
|
446
|
+
siblings: siblings$1
|
|
447
|
+
}, options)).filter(Boolean));
|
|
448
|
+
},
|
|
449
|
+
and(tree, options) {
|
|
450
|
+
const { current, schema, name } = tree;
|
|
451
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.and)) return void 0;
|
|
452
|
+
const items = sort(current.args).filter((schema$1) => {
|
|
453
|
+
return ![__kubb_plugin_oas.schemaKeywords.optional, __kubb_plugin_oas.schemaKeywords.describe].includes(schema$1.keyword);
|
|
454
|
+
}).map((it, _index, siblings) => this.parse({
|
|
455
|
+
schema,
|
|
456
|
+
parent: current,
|
|
457
|
+
name,
|
|
458
|
+
current: it,
|
|
459
|
+
siblings
|
|
460
|
+
}, options)).filter(Boolean);
|
|
461
|
+
return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`;
|
|
462
|
+
},
|
|
463
|
+
array(tree, options) {
|
|
464
|
+
const { current, schema, name } = tree;
|
|
465
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.array)) return void 0;
|
|
466
|
+
return zodKeywordMapper.array(sort(current.args.items).map((it, _index, siblings) => {
|
|
467
|
+
return this.parse({
|
|
489
468
|
schema,
|
|
490
469
|
parent: current,
|
|
491
470
|
name,
|
|
492
471
|
current: it,
|
|
493
|
-
siblings
|
|
472
|
+
siblings
|
|
494
473
|
}, options);
|
|
495
|
-
}).filter(Boolean));
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
if (
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
474
|
+
}).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
|
|
475
|
+
},
|
|
476
|
+
enum(tree, options) {
|
|
477
|
+
const { current, schema, name } = tree;
|
|
478
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.enum)) return void 0;
|
|
479
|
+
if (current.args.asConst) {
|
|
480
|
+
if (current.args.items.length === 1) {
|
|
481
|
+
const child = {
|
|
482
|
+
keyword: __kubb_plugin_oas.schemaKeywords.const,
|
|
483
|
+
args: current.args.items[0]
|
|
484
|
+
};
|
|
485
|
+
return this.parse({
|
|
486
|
+
schema,
|
|
487
|
+
parent: current,
|
|
488
|
+
name,
|
|
489
|
+
current: child,
|
|
490
|
+
siblings: [child]
|
|
491
|
+
}, options);
|
|
492
|
+
}
|
|
493
|
+
return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
|
|
494
|
+
keyword: __kubb_plugin_oas.schemaKeywords.const,
|
|
495
|
+
args: schema$1
|
|
496
|
+
})).map((it, _index, siblings) => {
|
|
497
|
+
return this.parse({
|
|
498
|
+
schema,
|
|
499
|
+
parent: current,
|
|
500
|
+
name,
|
|
501
|
+
current: it,
|
|
502
|
+
siblings
|
|
503
|
+
}, options);
|
|
504
|
+
}).filter(Boolean));
|
|
505
|
+
}
|
|
506
|
+
return zodKeywordMapper.enum(current.args.items.map((schema$1) => {
|
|
507
|
+
if (schema$1.format === "boolean") return __kubb_core_transformers.default.stringify(schema$1.value);
|
|
508
|
+
if (schema$1.format === "number") return __kubb_core_transformers.default.stringify(schema$1.value);
|
|
509
|
+
return __kubb_core_transformers.default.stringify(schema$1.value);
|
|
510
|
+
}));
|
|
511
|
+
},
|
|
512
|
+
ref(tree, options) {
|
|
513
|
+
const { current } = tree;
|
|
514
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.ref)) return void 0;
|
|
515
|
+
if (options.skipLazyForRefs) return current.args?.name;
|
|
516
|
+
return zodKeywordMapper.ref(current.args?.name);
|
|
517
|
+
},
|
|
518
|
+
object(tree, options) {
|
|
519
|
+
const { current, schema, name } = tree;
|
|
520
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.object)) return void 0;
|
|
521
|
+
const properties = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
522
|
+
const schema$1 = item[1];
|
|
523
|
+
return schema$1 && typeof schema$1.map === "function";
|
|
524
|
+
}).map(([propertyName, schemas]) => {
|
|
525
|
+
const nameSchema = schemas.find((it) => it.keyword === __kubb_plugin_oas.schemaKeywords.name);
|
|
526
|
+
const isNullable = schemas.some((it) => (0, __kubb_plugin_oas.isKeyword)(it, __kubb_plugin_oas.schemaKeywords.nullable));
|
|
527
|
+
const isNullish = schemas.some((it) => (0, __kubb_plugin_oas.isKeyword)(it, __kubb_plugin_oas.schemaKeywords.nullish));
|
|
528
|
+
const isOptional = schemas.some((it) => (0, __kubb_plugin_oas.isKeyword)(it, __kubb_plugin_oas.schemaKeywords.optional));
|
|
529
|
+
const hasRef = !!__kubb_plugin_oas.SchemaGenerator.find(schemas, __kubb_plugin_oas.schemaKeywords.ref);
|
|
530
|
+
const mappedName = nameSchema?.args || propertyName;
|
|
531
|
+
if (options.mapper?.[mappedName]) return `"${propertyName}": ${options.mapper?.[mappedName]}`;
|
|
532
|
+
const baseSchemaOutput = sort(schemas).filter((schema$1) => {
|
|
533
|
+
return !(0, __kubb_plugin_oas.isKeyword)(schema$1, __kubb_plugin_oas.schemaKeywords.optional) && !(0, __kubb_plugin_oas.isKeyword)(schema$1, __kubb_plugin_oas.schemaKeywords.nullable) && !(0, __kubb_plugin_oas.isKeyword)(schema$1, __kubb_plugin_oas.schemaKeywords.nullish);
|
|
534
|
+
}).map((it) => {
|
|
535
|
+
const skipLazyForRefs = options.version === "4" && hasRef;
|
|
536
|
+
return this.parse({
|
|
537
|
+
schema,
|
|
538
|
+
parent: current,
|
|
539
|
+
name,
|
|
540
|
+
current: it,
|
|
541
|
+
siblings: schemas
|
|
542
|
+
}, {
|
|
543
|
+
...options,
|
|
544
|
+
skipLazyForRefs
|
|
545
|
+
});
|
|
546
|
+
}).filter(Boolean).join("");
|
|
547
|
+
const objectValue = options.wrapOutput ? options.wrapOutput({
|
|
548
|
+
output: baseSchemaOutput,
|
|
549
|
+
schema: schema?.properties?.[propertyName]
|
|
550
|
+
}) || baseSchemaOutput : baseSchemaOutput;
|
|
551
|
+
if (options.version === "4" && hasRef) {
|
|
552
|
+
if (options.mini) {
|
|
553
|
+
if (isNullish) return `get "${propertyName}"(){
|
|
541
554
|
return ${zodKeywordMapper.nullish(objectValue)}
|
|
542
555
|
}`;
|
|
543
|
-
|
|
556
|
+
if (isOptional) return `get "${propertyName}"(){
|
|
544
557
|
return ${zodKeywordMapper.optional(objectValue)}
|
|
545
558
|
}`;
|
|
546
|
-
|
|
559
|
+
if (isNullable) return `get "${propertyName}"(){
|
|
547
560
|
return ${zodKeywordMapper.nullable(objectValue)}
|
|
548
561
|
}`;
|
|
549
|
-
|
|
562
|
+
return `get "${propertyName}"(){
|
|
550
563
|
return ${objectValue}
|
|
551
564
|
}`;
|
|
552
|
-
|
|
553
|
-
|
|
565
|
+
}
|
|
566
|
+
if (isNullish) return `get "${propertyName}"(){
|
|
554
567
|
return ${objectValue}${zodKeywordMapper.nullish()}
|
|
555
568
|
}`;
|
|
556
|
-
|
|
569
|
+
if (isOptional) return `get "${propertyName}"(){
|
|
557
570
|
return ${objectValue}${zodKeywordMapper.optional()}
|
|
558
571
|
}`;
|
|
559
|
-
|
|
572
|
+
if (isNullable) return `get "${propertyName}"(){
|
|
560
573
|
return ${objectValue}${zodKeywordMapper.nullable()}
|
|
561
574
|
}`;
|
|
562
|
-
|
|
575
|
+
return `get "${propertyName}"(){
|
|
563
576
|
return ${objectValue}
|
|
564
577
|
}`;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
578
|
+
}
|
|
579
|
+
if (isNullish) return `"${propertyName}": ${objectValue}${zodKeywordMapper.nullish()}`;
|
|
580
|
+
if (isOptional) return `"${propertyName}": ${zodKeywordMapper.optional(objectValue)}`;
|
|
581
|
+
if (isNullable) return `"${propertyName}": ${zodKeywordMapper.nullable(objectValue)}`;
|
|
582
|
+
return `"${propertyName}": ${objectValue}`;
|
|
583
|
+
}).join(",\n");
|
|
584
|
+
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((it, _index, siblings) => this.parse({
|
|
585
|
+
schema,
|
|
586
|
+
parent: current,
|
|
587
|
+
name,
|
|
588
|
+
current: it,
|
|
589
|
+
siblings
|
|
590
|
+
}, options)).filter(Boolean).join("") : void 0;
|
|
591
|
+
return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : void 0].filter(Boolean).join("");
|
|
592
|
+
},
|
|
593
|
+
tuple(tree, options) {
|
|
594
|
+
const { current, schema, name } = tree;
|
|
595
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.tuple)) return void 0;
|
|
596
|
+
return zodKeywordMapper.tuple(current.args.items.map((it, _index, siblings) => this.parse({
|
|
597
|
+
schema,
|
|
598
|
+
parent: current,
|
|
599
|
+
name,
|
|
600
|
+
current: it,
|
|
601
|
+
siblings
|
|
602
|
+
}, options)).filter(Boolean));
|
|
603
|
+
},
|
|
604
|
+
const(tree, _options) {
|
|
605
|
+
const { current } = tree;
|
|
606
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.const)) return void 0;
|
|
607
|
+
if (current.args.format === "number" && current.args.value !== void 0) return zodKeywordMapper.const(Number(current.args.value));
|
|
608
|
+
if (current.args.format === "boolean" && current.args.value !== void 0) return zodKeywordMapper.const(typeof current.args.value === "boolean" ? current.args.value : void 0);
|
|
609
|
+
return zodKeywordMapper.const(__kubb_core_transformers.default.stringify(current.args.value));
|
|
610
|
+
},
|
|
611
|
+
matches(tree, options) {
|
|
612
|
+
const { current, siblings } = tree;
|
|
613
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.matches)) return void 0;
|
|
614
|
+
if (siblings.some((it) => (0, __kubb_plugin_oas.isKeyword)(it, __kubb_plugin_oas.schemaKeywords.ref))) return;
|
|
615
|
+
if (current.args) return zodKeywordMapper.matches(__kubb_core_transformers.default.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"), options.mini);
|
|
616
|
+
},
|
|
617
|
+
default(tree, options) {
|
|
618
|
+
const { current } = tree;
|
|
619
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.default)) return void 0;
|
|
620
|
+
if (options.mini) return;
|
|
621
|
+
if (current.args !== void 0) return zodKeywordMapper.default(current.args);
|
|
622
|
+
return zodKeywordMapper.default();
|
|
623
|
+
},
|
|
624
|
+
describe(tree, options) {
|
|
625
|
+
const { current } = tree;
|
|
626
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.describe)) return void 0;
|
|
627
|
+
if (current.args) return zodKeywordMapper.describe(__kubb_core_transformers.default.stringify(current.args.toString()), void 0, options.mini);
|
|
628
|
+
},
|
|
629
|
+
string(tree, options) {
|
|
630
|
+
const { current, siblings } = tree;
|
|
631
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.string)) return void 0;
|
|
632
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
633
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
634
|
+
return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args, options.mini);
|
|
635
|
+
},
|
|
636
|
+
uuid(tree, options) {
|
|
637
|
+
const { current, siblings } = tree;
|
|
638
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.uuid)) return void 0;
|
|
639
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
640
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
641
|
+
return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
642
|
+
},
|
|
643
|
+
email(tree, options) {
|
|
644
|
+
const { current, siblings } = tree;
|
|
645
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.email)) return void 0;
|
|
646
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
647
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
648
|
+
return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
649
|
+
},
|
|
650
|
+
url(tree, options) {
|
|
651
|
+
const { current, siblings } = tree;
|
|
652
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.url)) return void 0;
|
|
653
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
654
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
655
|
+
return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
656
|
+
},
|
|
657
|
+
number(tree, options) {
|
|
658
|
+
const { current, siblings } = tree;
|
|
659
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.number)) return void 0;
|
|
660
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
661
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
662
|
+
const exclusiveMinimumSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "exclusiveMinimum");
|
|
663
|
+
const exclusiveMaximumSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "exclusiveMaximum");
|
|
664
|
+
return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
665
|
+
},
|
|
666
|
+
integer(tree, options) {
|
|
667
|
+
const { current, siblings } = tree;
|
|
668
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.integer)) return void 0;
|
|
669
|
+
const minSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "min");
|
|
670
|
+
const maxSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "max");
|
|
671
|
+
const exclusiveMinimumSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "exclusiveMinimum");
|
|
672
|
+
const exclusiveMaximumSchema = (0, __kubb_plugin_oas.findSchemaKeyword)(siblings, "exclusiveMaximum");
|
|
673
|
+
return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
674
|
+
},
|
|
675
|
+
datetime(tree, options) {
|
|
676
|
+
const { current } = tree;
|
|
677
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.datetime)) return void 0;
|
|
678
|
+
return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini);
|
|
679
|
+
},
|
|
680
|
+
date(tree, options) {
|
|
681
|
+
const { current } = tree;
|
|
682
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.date)) return void 0;
|
|
683
|
+
return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
684
|
+
},
|
|
685
|
+
time(tree, options) {
|
|
686
|
+
const { current } = tree;
|
|
687
|
+
if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.time)) return void 0;
|
|
688
|
+
return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
689
|
+
}
|
|
642
690
|
}
|
|
643
|
-
|
|
644
|
-
}
|
|
691
|
+
});
|
|
645
692
|
|
|
646
693
|
//#endregion
|
|
647
694
|
//#region src/components/Zod.tsx
|
|
@@ -743,4 +790,4 @@ Object.defineProperty(exports, '__toESM', {
|
|
|
743
790
|
return __toESM;
|
|
744
791
|
}
|
|
745
792
|
});
|
|
746
|
-
//# sourceMappingURL=components-
|
|
793
|
+
//# sourceMappingURL=components-DaK9uYjS.cjs.map
|