@kubb/plugin-zod 4.10.1 → 4.11.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.
@@ -1,5 +1,5 @@
1
1
  import transformers from "@kubb/core/transformers";
2
- import { SchemaGenerator, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
2
+ import { SchemaGenerator, createParser, findSchemaKeyword, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
3
3
  import { Const, File, Type } from "@kubb/react-fabric";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
5
5
 
@@ -230,6 +230,8 @@ const zodKeywordMapper = {
230
230
  default: (value, innerSchema, mini) => {
231
231
  if (mini && innerSchema) return `z._default(${innerSchema}, ${typeof value === "object" ? "{}" : value ?? ""})`;
232
232
  if (typeof value === "object") return ".default({})";
233
+ if (value === void 0) return ".default()";
234
+ if (typeof value === "string" && !value) return `.default('')`;
233
235
  return `.default(${value ?? ""})`;
234
236
  },
235
237
  and: (items = [], mini) => {
@@ -394,226 +396,271 @@ const shouldCoerce = (coercion, type) => {
394
396
  if (typeof coercion === "boolean") return coercion;
395
397
  return !!coercion[type];
396
398
  };
397
- function parse({ schema, parent, current, name, siblings }, options) {
398
- const value = zodKeywordMapper[current.keyword];
399
- const hasMatches = siblings.some((it) => isKeyword(it, schemaKeywords.matches));
400
- const hasRef = siblings.some((it) => isKeyword(it, schemaKeywords.ref));
401
- if (hasMatches && hasRef && isKeyword(current, schemaKeywords.matches)) return;
402
- if (!value) return;
403
- if (isKeyword(current, schemaKeywords.union)) {
404
- if (Array.isArray(current.args) && current.args.length === 1) return parse({
405
- schema,
406
- parent,
407
- name,
408
- current: current.args[0],
409
- siblings
410
- }, options);
411
- if (Array.isArray(current.args) && !current.args.length) return "";
412
- return zodKeywordMapper.union(sort(current.args).map((it, _index, siblings$1) => parse({
413
- schema,
414
- parent: current,
415
- name,
416
- current: it,
417
- siblings: siblings$1
418
- }, options)).filter(Boolean));
419
- }
420
- if (isKeyword(current, schemaKeywords.and)) {
421
- const items = sort(current.args).filter((schema$1) => {
422
- return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema$1.keyword);
423
- }).map((it, _index, siblings$1) => parse({
424
- schema,
425
- parent: current,
426
- name,
427
- current: it,
428
- siblings: siblings$1
429
- }, options)).filter(Boolean);
430
- return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`;
431
- }
432
- if (isKeyword(current, schemaKeywords.array)) return zodKeywordMapper.array(sort(current.args.items).map((it, _index, siblings$1) => {
433
- return parse({
434
- schema,
435
- parent: current,
436
- name,
437
- current: it,
438
- siblings: siblings$1
439
- }, options);
440
- }).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
441
- if (isKeyword(current, schemaKeywords.enum)) {
442
- if (current.args.asConst) {
443
- if (current.args.items.length === 1) {
444
- const child = {
445
- keyword: schemaKeywords.const,
446
- args: current.args.items[0]
447
- };
448
- return parse({
449
- schema,
450
- parent: current,
451
- name,
452
- current: child,
453
- siblings: [child]
454
- }, options);
455
- }
456
- return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
457
- keyword: schemaKeywords.const,
458
- args: schema$1
459
- })).map((it, _index, siblings$1) => {
460
- return parse({
399
+ const parse = createParser({
400
+ mapper: zodKeywordMapper,
401
+ handlers: {
402
+ union(tree, options) {
403
+ const { current, schema, parent, name, siblings } = tree;
404
+ if (!isKeyword(current, schemaKeywords.union)) return void 0;
405
+ if (Array.isArray(current.args) && current.args.length === 1) return this.parse({
406
+ schema,
407
+ parent,
408
+ name,
409
+ current: current.args[0],
410
+ siblings
411
+ }, options);
412
+ if (Array.isArray(current.args) && !current.args.length) return "";
413
+ return zodKeywordMapper.union(sort(current.args).map((it, _index, siblings$1) => this.parse({
414
+ schema,
415
+ parent: current,
416
+ name,
417
+ current: it,
418
+ siblings: siblings$1
419
+ }, options)).filter(Boolean));
420
+ },
421
+ and(tree, options) {
422
+ const { current, schema, name } = tree;
423
+ if (!isKeyword(current, schemaKeywords.and)) return void 0;
424
+ const items = sort(current.args).filter((schema$1) => {
425
+ return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema$1.keyword);
426
+ }).map((it, _index, siblings) => this.parse({
427
+ schema,
428
+ parent: current,
429
+ name,
430
+ current: it,
431
+ siblings
432
+ }, options)).filter(Boolean);
433
+ return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`;
434
+ },
435
+ array(tree, options) {
436
+ const { current, schema, name } = tree;
437
+ if (!isKeyword(current, schemaKeywords.array)) return void 0;
438
+ return zodKeywordMapper.array(sort(current.args.items).map((it, _index, siblings) => {
439
+ return this.parse({
461
440
  schema,
462
441
  parent: current,
463
442
  name,
464
443
  current: it,
465
- siblings: siblings$1
444
+ siblings
466
445
  }, options);
467
- }).filter(Boolean));
468
- }
469
- return zodKeywordMapper.enum(current.args.items.map((schema$1) => {
470
- if (schema$1.format === "boolean") return transformers.stringify(schema$1.value);
471
- if (schema$1.format === "number") return transformers.stringify(schema$1.value);
472
- return transformers.stringify(schema$1.value);
473
- }));
474
- }
475
- if (isKeyword(current, schemaKeywords.ref)) {
476
- if (options.skipLazyForRefs) return current.args?.name;
477
- return zodKeywordMapper.ref(current.args?.name);
478
- }
479
- if (isKeyword(current, schemaKeywords.object)) {
480
- const properties = Object.entries(current.args?.properties || {}).filter((item) => {
481
- const schema$1 = item[1];
482
- return schema$1 && typeof schema$1.map === "function";
483
- }).map(([propertyName, schemas]) => {
484
- const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name);
485
- const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable));
486
- const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish));
487
- const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional));
488
- const hasRef$1 = !!SchemaGenerator.find(schemas, schemaKeywords.ref);
489
- const mappedName = nameSchema?.args || propertyName;
490
- if (options.mapper?.[mappedName]) return `"${propertyName}": ${options.mapper?.[mappedName]}`;
491
- const baseSchemaOutput = sort(schemas).filter((schema$1) => {
492
- return !isKeyword(schema$1, schemaKeywords.optional) && !isKeyword(schema$1, schemaKeywords.nullable) && !isKeyword(schema$1, schemaKeywords.nullish);
493
- }).map((it) => {
494
- const skipLazyForRefs = options.version === "4" && hasRef$1;
495
- return parse({
496
- schema,
497
- parent: current,
498
- name,
499
- current: it,
500
- siblings: schemas
501
- }, {
502
- ...options,
503
- skipLazyForRefs
504
- });
505
- }).filter(Boolean).join("");
506
- const objectValue = options.wrapOutput ? options.wrapOutput({
507
- output: baseSchemaOutput,
508
- schema: schema?.properties?.[propertyName]
509
- }) || baseSchemaOutput : baseSchemaOutput;
510
- if (options.version === "4" && hasRef$1) {
511
- if (options.mini) {
512
- if (isNullish) return `get "${propertyName}"(){
446
+ }).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
447
+ },
448
+ enum(tree, options) {
449
+ const { current, schema, name } = tree;
450
+ if (!isKeyword(current, schemaKeywords.enum)) return void 0;
451
+ if (current.args.asConst) {
452
+ if (current.args.items.length === 1) {
453
+ const child = {
454
+ keyword: schemaKeywords.const,
455
+ args: current.args.items[0]
456
+ };
457
+ return this.parse({
458
+ schema,
459
+ parent: current,
460
+ name,
461
+ current: child,
462
+ siblings: [child]
463
+ }, options);
464
+ }
465
+ return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
466
+ keyword: schemaKeywords.const,
467
+ args: schema$1
468
+ })).map((it, _index, siblings) => {
469
+ return this.parse({
470
+ schema,
471
+ parent: current,
472
+ name,
473
+ current: it,
474
+ siblings
475
+ }, options);
476
+ }).filter(Boolean));
477
+ }
478
+ return zodKeywordMapper.enum(current.args.items.map((schema$1) => {
479
+ if (schema$1.format === "boolean") return transformers.stringify(schema$1.value);
480
+ if (schema$1.format === "number") return transformers.stringify(schema$1.value);
481
+ return transformers.stringify(schema$1.value);
482
+ }));
483
+ },
484
+ ref(tree, options) {
485
+ const { current } = tree;
486
+ if (!isKeyword(current, schemaKeywords.ref)) return void 0;
487
+ if (options.skipLazyForRefs) return current.args?.name;
488
+ return zodKeywordMapper.ref(current.args?.name);
489
+ },
490
+ object(tree, options) {
491
+ const { current, schema, name } = tree;
492
+ if (!isKeyword(current, schemaKeywords.object)) return void 0;
493
+ const properties = Object.entries(current.args?.properties || {}).filter((item) => {
494
+ const schema$1 = item[1];
495
+ return schema$1 && typeof schema$1.map === "function";
496
+ }).map(([propertyName, schemas]) => {
497
+ const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name);
498
+ const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable));
499
+ const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish));
500
+ const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional));
501
+ const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref);
502
+ const mappedName = nameSchema?.args || propertyName;
503
+ if (options.mapper?.[mappedName]) return `"${propertyName}": ${options.mapper?.[mappedName]}`;
504
+ const baseSchemaOutput = sort(schemas).filter((schema$1) => {
505
+ return !isKeyword(schema$1, schemaKeywords.optional) && !isKeyword(schema$1, schemaKeywords.nullable) && !isKeyword(schema$1, schemaKeywords.nullish);
506
+ }).map((it) => {
507
+ const skipLazyForRefs = options.version === "4" && hasRef;
508
+ return this.parse({
509
+ schema,
510
+ parent: current,
511
+ name,
512
+ current: it,
513
+ siblings: schemas
514
+ }, {
515
+ ...options,
516
+ skipLazyForRefs
517
+ });
518
+ }).filter(Boolean).join("");
519
+ const objectValue = options.wrapOutput ? options.wrapOutput({
520
+ output: baseSchemaOutput,
521
+ schema: schema?.properties?.[propertyName]
522
+ }) || baseSchemaOutput : baseSchemaOutput;
523
+ if (options.version === "4" && hasRef) {
524
+ if (options.mini) {
525
+ if (isNullish) return `get "${propertyName}"(){
513
526
  return ${zodKeywordMapper.nullish(objectValue)}
514
527
  }`;
515
- if (isOptional) return `get "${propertyName}"(){
528
+ if (isOptional) return `get "${propertyName}"(){
516
529
  return ${zodKeywordMapper.optional(objectValue)}
517
530
  }`;
518
- if (isNullable) return `get "${propertyName}"(){
531
+ if (isNullable) return `get "${propertyName}"(){
519
532
  return ${zodKeywordMapper.nullable(objectValue)}
520
533
  }`;
521
- return `get "${propertyName}"(){
534
+ return `get "${propertyName}"(){
522
535
  return ${objectValue}
523
536
  }`;
524
- }
525
- if (isNullish) return `get "${propertyName}"(){
537
+ }
538
+ if (isNullish) return `get "${propertyName}"(){
526
539
  return ${objectValue}${zodKeywordMapper.nullish()}
527
540
  }`;
528
- if (isOptional) return `get "${propertyName}"(){
541
+ if (isOptional) return `get "${propertyName}"(){
529
542
  return ${objectValue}${zodKeywordMapper.optional()}
530
543
  }`;
531
- if (isNullable) return `get "${propertyName}"(){
544
+ if (isNullable) return `get "${propertyName}"(){
532
545
  return ${objectValue}${zodKeywordMapper.nullable()}
533
546
  }`;
534
- return `get "${propertyName}"(){
547
+ return `get "${propertyName}"(){
535
548
  return ${objectValue}
536
549
  }`;
537
- }
538
- if (isNullish) return `"${propertyName}": ${objectValue}${zodKeywordMapper.nullish()}`;
539
- if (isOptional) return `"${propertyName}": ${zodKeywordMapper.optional(objectValue)}`;
540
- if (isNullable) return `"${propertyName}": ${zodKeywordMapper.nullable(objectValue)}`;
541
- return `"${propertyName}": ${objectValue}`;
542
- }).join(",\n");
543
- const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((it, _index, siblings$1) => parse({
544
- schema,
545
- parent: current,
546
- name,
547
- current: it,
548
- siblings: siblings$1
549
- }, options)).filter(Boolean).join("") : void 0;
550
- return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : void 0].filter(Boolean).join("");
551
- }
552
- if (isKeyword(current, schemaKeywords.tuple)) return zodKeywordMapper.tuple(current.args.items.map((it, _index, siblings$1) => parse({
553
- schema,
554
- parent: current,
555
- name,
556
- current: it,
557
- siblings: siblings$1
558
- }, options)).filter(Boolean));
559
- if (isKeyword(current, schemaKeywords.const)) {
560
- if (current.args.format === "number" && current.args.value !== void 0) return zodKeywordMapper.const(Number(current.args.value));
561
- if (current.args.format === "boolean" && current.args.value !== void 0) return zodKeywordMapper.const(current.args.value);
562
- return zodKeywordMapper.const(transformers.stringify(current.args.value));
563
- }
564
- if (isKeyword(current, schemaKeywords.matches)) {
565
- if (current.args) return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"), options.mini);
566
- }
567
- if (isKeyword(current, schemaKeywords.default)) {
568
- if (options.mini) return;
569
- if (current.args) return zodKeywordMapper.default(current.args);
570
- }
571
- if (isKeyword(current, schemaKeywords.describe)) {
572
- if (current.args) return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), void 0, options.mini);
573
- }
574
- if (isKeyword(current, schemaKeywords.string)) {
575
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
576
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
577
- return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args, options.mini);
578
- }
579
- if (isKeyword(current, schemaKeywords.uuid)) {
580
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
581
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
582
- return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
583
- }
584
- if (isKeyword(current, schemaKeywords.email)) {
585
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
586
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
587
- return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
588
- }
589
- if (isKeyword(current, schemaKeywords.url)) {
590
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
591
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
592
- return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
593
- }
594
- if (isKeyword(current, schemaKeywords.number)) {
595
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
596
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
597
- const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum);
598
- const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum);
599
- return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
600
- }
601
- if (isKeyword(current, schemaKeywords.integer)) {
602
- const minSchema = SchemaGenerator.find(siblings, schemaKeywords.min);
603
- const maxSchema = SchemaGenerator.find(siblings, schemaKeywords.max);
604
- const exclusiveMinimumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMinimum);
605
- const exclusiveMaximumSchema = SchemaGenerator.find(siblings, schemaKeywords.exclusiveMaximum);
606
- return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
607
- }
608
- if (isKeyword(current, schemaKeywords.datetime)) return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini);
609
- if (isKeyword(current, schemaKeywords.date)) return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
610
- if (isKeyword(current, schemaKeywords.time)) return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
611
- if (current.keyword in zodKeywordMapper && "args" in current) {
612
- const value$1 = zodKeywordMapper[current.keyword];
613
- return value$1(current.args);
550
+ }
551
+ if (isNullish) return `"${propertyName}": ${objectValue}${zodKeywordMapper.nullish()}`;
552
+ if (isOptional) return `"${propertyName}": ${zodKeywordMapper.optional(objectValue)}`;
553
+ if (isNullable) return `"${propertyName}": ${zodKeywordMapper.nullable(objectValue)}`;
554
+ return `"${propertyName}": ${objectValue}`;
555
+ }).join(",\n");
556
+ const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((it, _index, siblings) => this.parse({
557
+ schema,
558
+ parent: current,
559
+ name,
560
+ current: it,
561
+ siblings
562
+ }, options)).filter(Boolean).join("") : void 0;
563
+ return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : void 0].filter(Boolean).join("");
564
+ },
565
+ tuple(tree, options) {
566
+ const { current, schema, name } = tree;
567
+ if (!isKeyword(current, schemaKeywords.tuple)) return void 0;
568
+ return zodKeywordMapper.tuple(current.args.items.map((it, _index, siblings) => this.parse({
569
+ schema,
570
+ parent: current,
571
+ name,
572
+ current: it,
573
+ siblings
574
+ }, options)).filter(Boolean));
575
+ },
576
+ const(tree, _options) {
577
+ const { current } = tree;
578
+ if (!isKeyword(current, schemaKeywords.const)) return void 0;
579
+ if (current.args.format === "number" && current.args.value !== void 0) return zodKeywordMapper.const(Number(current.args.value));
580
+ if (current.args.format === "boolean" && current.args.value !== void 0) return zodKeywordMapper.const(typeof current.args.value === "boolean" ? current.args.value : void 0);
581
+ return zodKeywordMapper.const(transformers.stringify(current.args.value));
582
+ },
583
+ matches(tree, options) {
584
+ const { current, siblings } = tree;
585
+ if (!isKeyword(current, schemaKeywords.matches)) return void 0;
586
+ if (siblings.some((it) => isKeyword(it, schemaKeywords.ref))) return;
587
+ if (current.args) return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"), options.mini);
588
+ },
589
+ default(tree, options) {
590
+ const { current } = tree;
591
+ if (!isKeyword(current, schemaKeywords.default)) return void 0;
592
+ if (options.mini) return;
593
+ if (current.args !== void 0) return zodKeywordMapper.default(current.args);
594
+ return zodKeywordMapper.default();
595
+ },
596
+ describe(tree, options) {
597
+ const { current } = tree;
598
+ if (!isKeyword(current, schemaKeywords.describe)) return void 0;
599
+ if (current.args) return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), void 0, options.mini);
600
+ },
601
+ string(tree, options) {
602
+ const { current, siblings } = tree;
603
+ if (!isKeyword(current, schemaKeywords.string)) return void 0;
604
+ const minSchema = findSchemaKeyword(siblings, "min");
605
+ const maxSchema = findSchemaKeyword(siblings, "max");
606
+ return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args, options.mini);
607
+ },
608
+ uuid(tree, options) {
609
+ const { current, siblings } = tree;
610
+ if (!isKeyword(current, schemaKeywords.uuid)) return void 0;
611
+ const minSchema = findSchemaKeyword(siblings, "min");
612
+ const maxSchema = findSchemaKeyword(siblings, "max");
613
+ return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
614
+ },
615
+ email(tree, options) {
616
+ const { current, siblings } = tree;
617
+ if (!isKeyword(current, schemaKeywords.email)) return void 0;
618
+ const minSchema = findSchemaKeyword(siblings, "min");
619
+ const maxSchema = findSchemaKeyword(siblings, "max");
620
+ return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
621
+ },
622
+ url(tree, options) {
623
+ const { current, siblings } = tree;
624
+ if (!isKeyword(current, schemaKeywords.url)) return void 0;
625
+ const minSchema = findSchemaKeyword(siblings, "min");
626
+ const maxSchema = findSchemaKeyword(siblings, "max");
627
+ return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
628
+ },
629
+ number(tree, options) {
630
+ const { current, siblings } = tree;
631
+ if (!isKeyword(current, schemaKeywords.number)) return void 0;
632
+ const minSchema = findSchemaKeyword(siblings, "min");
633
+ const maxSchema = findSchemaKeyword(siblings, "max");
634
+ const exclusiveMinimumSchema = findSchemaKeyword(siblings, "exclusiveMinimum");
635
+ const exclusiveMaximumSchema = findSchemaKeyword(siblings, "exclusiveMaximum");
636
+ return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
637
+ },
638
+ integer(tree, options) {
639
+ const { current, siblings } = tree;
640
+ if (!isKeyword(current, schemaKeywords.integer)) return void 0;
641
+ const minSchema = findSchemaKeyword(siblings, "min");
642
+ const maxSchema = findSchemaKeyword(siblings, "max");
643
+ const exclusiveMinimumSchema = findSchemaKeyword(siblings, "exclusiveMinimum");
644
+ const exclusiveMaximumSchema = findSchemaKeyword(siblings, "exclusiveMaximum");
645
+ return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
646
+ },
647
+ datetime(tree, options) {
648
+ const { current } = tree;
649
+ if (!isKeyword(current, schemaKeywords.datetime)) return void 0;
650
+ return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini);
651
+ },
652
+ date(tree, options) {
653
+ const { current } = tree;
654
+ if (!isKeyword(current, schemaKeywords.date)) return void 0;
655
+ return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
656
+ },
657
+ time(tree, options) {
658
+ const { current } = tree;
659
+ if (!isKeyword(current, schemaKeywords.time)) return void 0;
660
+ return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
661
+ }
614
662
  }
615
- if (current.keyword in zodKeywordMapper) return value();
616
- }
663
+ });
617
664
 
618
665
  //#endregion
619
666
  //#region src/components/Zod.tsx
@@ -698,4 +745,4 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
698
745
 
699
746
  //#endregion
700
747
  export { Operations as n, Zod as t };
701
- //# sourceMappingURL=components-BCKi8Hou.js.map
748
+ //# sourceMappingURL=components-B9udp6Zi.js.map