@kubb/plugin-zod 4.18.3 → 4.18.5

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.
@@ -37,7 +37,7 @@ declare class Oas extends BaseOas {
37
37
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
38
38
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
39
39
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
40
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
40
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
41
41
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
42
42
  }
43
43
  //#endregion
@@ -339,7 +339,7 @@ type Config<TInput = Input> = {
339
339
  input: TInput;
340
340
  output: {
341
341
  /**
342
- * The path where all generated files will be exported.
342
+ * The path where all generated files receives exported.
343
343
  * This can be an absolute path or a path relative to the specified root option.
344
344
  */
345
345
  path: string;
@@ -354,41 +354,39 @@ type Config<TInput = Input> = {
354
354
  write?: boolean;
355
355
  /**
356
356
  * Specifies the formatting tool to be used.
357
- * @default prettier
358
- *
359
- * Possible values:
360
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
361
- * - 'prettier': Uses Prettier for code formatting.
362
- * - 'biome': Uses Biome for code formatting.
363
- *
357
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
358
+ * - 'prettier' uses Prettier for code formatting.
359
+ * - 'biome' uses Biome for code formatting.
360
+ * - 'oxfmt' uses Oxfmt for code formatting.
361
+ * - false disables code formatting.
362
+ * @default 'prettier'
364
363
  */
365
364
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
366
365
  /**
367
366
  * Specifies the linter that should be used to analyze the code.
368
- * The accepted values indicate different linting tools.
369
- *
370
- * Possible values:
371
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
372
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
373
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
374
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
375
- *
367
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
368
+ * - 'eslint' uses ESLint for linting.
369
+ * - 'biome' uses Biome for linting.
370
+ * - 'oxlint' uses Oxlint for linting.
371
+ * - false disables linting.
372
+ * @default 'auto'
376
373
  */
377
374
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
378
375
  /**
379
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
376
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
380
377
  * @default { '.ts': '.ts'}
381
378
  */
382
379
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
383
380
  /**
384
- * Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
381
+ * Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
385
382
  * @default 'named'
386
383
  */
387
384
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
388
385
  /**
389
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
390
- * - 'simple': will only add banner with link to Kubb
391
- * - 'full': will add source, title, description and the OpenAPI version used
386
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
387
+ * - 'simple' adds banner with link to Kubb.
388
+ * - 'full' adds source, title, description, and OpenAPI version.
389
+ * - false disables banner generation.
392
390
  * @default 'simple'
393
391
  */
394
392
  defaultBanner?: 'simple' | 'full' | false;
@@ -401,17 +399,17 @@ type Config<TInput = Input> = {
401
399
  override?: boolean;
402
400
  };
403
401
  /**
404
- * An array of Kubb plugins that will be used in the generation.
402
+ * An array of Kubb plugins that used in the generation.
405
403
  * Each plugin may include additional configurable options(defined in the plugin itself).
406
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
404
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
407
405
  */
408
406
  plugins?: Array<Plugin>;
409
407
  /**
410
- * Hooks that will be called when a specific action is triggered in Kubb.
408
+ * Hooks triggered when a specific action occurs in Kubb.
411
409
  */
412
410
  hooks?: {
413
411
  /**
414
- * Hook that will be triggered at the end of all executions.
412
+ * Hook that triggers at the end of all executions.
415
413
  * Useful for running Prettier or ESLint to format/lint your code.
416
414
  */
417
415
  done?: string | Array<string>;
@@ -440,7 +438,7 @@ TContext = any,
440
438
  TResolvePathOptions extends object = object> = {
441
439
  name: TName;
442
440
  /**
443
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
441
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
444
442
  */
445
443
  key: PluginKey<TName | string>;
446
444
  options: TOptions;
@@ -461,12 +459,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
461
459
  */
462
460
  options: TOptions['resolvedOptions'];
463
461
  /**
464
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
462
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
465
463
  * Can be used to validate dependent plugins.
466
464
  */
467
465
  pre?: Array<string>;
468
466
  /**
469
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
467
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
470
468
  */
471
469
  post?: Array<string>;
472
470
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -484,12 +482,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
484
482
  */
485
483
  key: TOptions['key'];
486
484
  /**
487
- * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
485
+ * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
488
486
  * Can be used to validate dependent plugins.
489
487
  */
490
488
  pre?: Array<string>;
491
489
  /**
492
- * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
490
+ * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
493
491
  */
494
492
  post?: Array<string>;
495
493
  /**
@@ -539,10 +537,12 @@ type ResolveNameParams = {
539
537
  name: string;
540
538
  pluginKey?: Plugin['key'];
541
539
  /**
542
- * `file` will be used to customize the name of the created file(use of camelCase)
543
- * `function` can be used to customize the exported functions(use of camelCase)
544
- * `type` is a special type for TypeScript(use of PascalCase)
545
- * `const` can be used for variables(use of camelCase)
540
+ * Specifies the type of entity being named.
541
+ * - 'file' customizes the name of the created file (uses camelCase).
542
+ * - 'function' customizes the exported function names (uses camelCase).
543
+ * - 'type' customizes TypeScript types (uses PascalCase).
544
+ * - 'const' customizes variable names (uses camelCase).
545
+ * @default undefined
546
546
  */
547
547
  type?: 'file' | 'function' | 'type' | 'const';
548
548
  };
@@ -597,11 +597,14 @@ type GroupContext = {
597
597
  };
598
598
  type Group = {
599
599
  /**
600
- * Define a type where to group the files on
600
+ * Defines the type where to group the files.
601
+ * - 'tag' groups files by OpenAPI tags.
602
+ * - 'path' groups files by OpenAPI paths.
603
+ * @default undefined
601
604
  */
602
605
  type: 'tag' | 'path';
603
606
  /**
604
- * Return the name of a group based on the group name, this will be used for the file and name generation
607
+ * Return the name of a group based on the group name, this used for the file and name generation
605
608
  */
606
609
  name?: (context: GroupContext) => string;
607
610
  };
@@ -673,7 +676,7 @@ declare class PluginManager {
673
676
  parameters: PluginParameter<H>;
674
677
  }): Array<ReturnType<ParseResult<H>>> | null;
675
678
  /**
676
- * First non-null result stops and will return it's value.
679
+ * Returns the first non-null result.
677
680
  */
678
681
  hookFirst<H extends PluginLifecycleHooks>({
679
682
  hookName,
@@ -685,7 +688,7 @@ declare class PluginManager {
685
688
  skipped?: ReadonlySet<Plugin> | null;
686
689
  }): Promise<SafeParseResult<H>>;
687
690
  /**
688
- * First non-null result stops and will return it's value.
691
+ * Returns the first non-null result.
689
692
  */
690
693
  hookFirstSync<H extends PluginLifecycleHooks>({
691
694
  hookName,
@@ -697,15 +700,15 @@ declare class PluginManager {
697
700
  skipped?: ReadonlySet<Plugin> | null;
698
701
  }): SafeParseResult<H>;
699
702
  /**
700
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
703
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
701
704
  */
702
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
705
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
703
706
  hookName,
704
707
  parameters
705
708
  }: {
706
709
  hookName: H;
707
710
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
708
- }): Promise<Awaited<TOuput>[]>;
711
+ }): Promise<Awaited<TOutput>[]>;
709
712
  /**
710
713
  * Chains plugins
711
714
  */
@@ -841,8 +844,8 @@ type SchemaKeywordMapper = {
841
844
  */
842
845
  path: KubbFile.Path;
843
846
  /**
844
- * When true `File.Import` will be used.
845
- * When false a reference will be used inside the current file.
847
+ * When true `File.Import` is used.
848
+ * When false a reference is used inside the current file.
846
849
  */
847
850
  isImportable: boolean;
848
851
  };
@@ -1074,7 +1077,7 @@ type SchemaGeneratorOptions = {
1074
1077
  */
1075
1078
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1076
1079
  /**
1077
- * Receive schema and name(propertName) and return FakerMeta array
1080
+ * Receive schema and name(propertyName) and return FakerMeta array
1078
1081
  * TODO TODO add docs
1079
1082
  * @beta
1080
1083
  */
@@ -1185,7 +1188,7 @@ type Options = {
1185
1188
  output?: Output<Oas>;
1186
1189
  /**
1187
1190
  * Define which contentType should be used.
1188
- * By default, the first JSON valid mediaType will be used
1191
+ * By default, the first JSON valid mediaType is used
1189
1192
  */
1190
1193
  contentType?: contentType;
1191
1194
  /**
@@ -1206,25 +1209,36 @@ type Options = {
1206
1209
  override?: Array<Override<ResolvedOptions>>;
1207
1210
  /**
1208
1211
  * Path to Zod
1209
- * It will be used as `import { z } from '${importPath}'`.
1210
- * It allows both relative and absolute path.
1211
- * the path will be applied as is, so relative path should be based on the file being generated.
1212
+ * It used as `import { z } from '${importPath}'`.
1213
+ * Accepts relative and absolute paths.
1214
+ * Path is used as-is; relative paths are based on the generated file location.
1212
1215
  * @default 'zod'
1213
1216
  */
1214
1217
  importPath?: string;
1215
1218
  /**
1216
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
1217
- * False will fallback on a simple z.string() format
1218
- * @default 'string' 'stringOffset' will become the default in Kubb v3
1219
+ * Choose to use date or datetime as JavaScript Date instead of string.
1220
+ * - false falls back to a simple z.string() format.
1221
+ * - 'string' uses z.string().datetime() for datetime validation.
1222
+ * - 'stringOffset' uses z.string().datetime({ offset: true }) for datetime with timezone offset validation.
1223
+ * - 'stringLocal' uses z.string().datetime({ local: true }) for local datetime validation.
1224
+ * - 'date' uses z.date() for JavaScript Date objects.
1225
+ * @default 'string'
1226
+ * @note 'stringOffset' will become the default in Kubb v3.
1219
1227
  */
1220
1228
  dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
1221
1229
  /**
1222
- * Which type to use when the Swagger/OpenAPI file is not providing more information
1230
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
1231
+ * - 'any' allows any value.
1232
+ * - 'unknown' requires type narrowing before use.
1233
+ * - 'void' represents no value.
1223
1234
  * @default 'any'
1224
1235
  */
1225
1236
  unknownType?: 'any' | 'unknown' | 'void';
1226
1237
  /**
1227
- * Which type to use for empty schema values
1238
+ * Which type to use for empty schema values.
1239
+ * - 'any' allows any value.
1240
+ * - 'unknown' requires type narrowing before use.
1241
+ * - 'void' represents no value.
1228
1242
  * @default `unknownType`
1229
1243
  */
1230
1244
  emptySchemaType?: 'any' | 'unknown' | 'void';
@@ -1253,7 +1267,7 @@ type Options = {
1253
1267
  */
1254
1268
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1255
1269
  /**
1256
- * Receive schema and baseName(propertName) and return FakerMeta array
1270
+ * Receive schema and baseName(propertyName) and return FakerMeta array
1257
1271
  * TODO TODO add docs
1258
1272
  * @beta
1259
1273
  */
@@ -1264,14 +1278,16 @@ type Options = {
1264
1278
  }, defaultSchemas: Schema[]) => Schema[] | undefined;
1265
1279
  };
1266
1280
  /**
1267
- * Which version of Zod should be used
1268
- * @default '3
1281
+ * Which version of Zod should be used.
1282
+ * - '3' uses Zod v3.x syntax and features.
1283
+ * - '4' uses Zod v4.x syntax and features.
1284
+ * @default '3'
1269
1285
  */
1270
1286
  version?: '3' | '4';
1271
1287
  /**
1272
1288
  * Use Zod Mini's functional API for better tree-shaking support.
1273
1289
  * When enabled, generates functional syntax (e.g., `z.optional(z.string())`) instead of chainable methods (e.g., `z.string().optional()`).
1274
- * Requires Zod v4 or later. When `mini: true`, `version` will be set to '4' and `importPath` will default to 'zod/mini'.
1290
+ * Requires Zod v4 or later. When `mini: true`, `version` is set to '4' and `importPath` will default to 'zod/mini'.
1275
1291
  * @default false
1276
1292
  */
1277
1293
  mini?: boolean;
@@ -1312,4 +1328,4 @@ type ResolvedOptions = {
1312
1328
  type PluginZod = PluginFactoryOptions<'plugin-zod', Options, ResolvedOptions, never, ResolvePathOptions>;
1313
1329
  //#endregion
1314
1330
  export { UserPluginWithLifeCycle as a, Schema as i, PluginZod as n, Operation$1 as o, ReactGenerator as r, SchemaObject$1 as s, Options as t };
1315
- //# sourceMappingURL=types-BNtlNlKK.d.ts.map
1331
+ //# sourceMappingURL=types-CaZySLsa.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-zod",
3
- "version": "4.18.3",
3
+ "version": "4.18.5",
4
4
  "description": "Zod schema generator plugin for Kubb, creating type-safe validation schemas from OpenAPI specifications for runtime data validation.",
5
5
  "keywords": [
6
6
  "zod",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "main": "./dist/index.cjs",
44
44
  "module": "./dist/index.js",
45
- "types": "./dist/index.d.cts",
45
+ "types": "./dist/index.d.ts",
46
46
  "typesVersions": {
47
47
  "*": {
48
48
  "components": [
@@ -68,11 +68,11 @@
68
68
  }
69
69
  ],
70
70
  "dependencies": {
71
- "@kubb/react-fabric": "0.11.8",
72
- "@kubb/oas": "4.18.3",
73
- "@kubb/plugin-oas": "4.18.3",
74
- "@kubb/core": "4.18.3",
75
- "@kubb/plugin-ts": "4.18.3"
71
+ "@kubb/react-fabric": "0.12.4",
72
+ "@kubb/core": "4.18.5",
73
+ "@kubb/oas": "4.18.5",
74
+ "@kubb/plugin-oas": "4.18.5",
75
+ "@kubb/plugin-ts": "4.18.5"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@asteasolutions/zod-to-openapi": "^8.4.0",
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import { z } from 'zod'
6
+
7
+ /**
8
+ * @description Success
9
+ */
10
+ export const createItem200 = z.lazy(() => item)
11
+
12
+ /**
13
+ * @description Item to create
14
+ */
15
+ export const createItemMutationRequest = z.union([
16
+ z
17
+ .lazy(() => itemTypeA)
18
+ .and(
19
+ z.object({
20
+ name: z.string(),
21
+ type: z.literal('typeA'),
22
+ }),
23
+ ),
24
+ z
25
+ .lazy(() => itemTypeB)
26
+ .and(
27
+ z.object({
28
+ name: z.string(),
29
+ type: z.literal('typeB'),
30
+ }),
31
+ ),
32
+ ])
33
+
34
+ export const createItemMutationResponse = z.lazy(() => createItem200)
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import { z } from '@hono/zod-openapi'
6
+
7
+ /**
8
+ * @description Success
9
+ */
10
+ export const createItem200 = z.lazy(() => item)
11
+
12
+ /**
13
+ * @description Item to create
14
+ */
15
+ export const createItemMutationRequest = z.union([
16
+ z
17
+ .lazy(() => itemTypeA)
18
+ .and(
19
+ z.object({
20
+ name: z.string(),
21
+ type: z.literal('typeA'),
22
+ }),
23
+ ),
24
+ z
25
+ .lazy(() => itemTypeB)
26
+ .and(
27
+ z.object({
28
+ name: z.string(),
29
+ type: z.literal('typeB'),
30
+ }),
31
+ ),
32
+ ])
33
+
34
+ export const createItemMutationResponse = z.lazy(() => createItem200)
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import { z } from 'zod'
6
+
7
+ export const item = z.union([
8
+ z
9
+ .lazy(() => itemTypeA)
10
+ .and(
11
+ z.object({
12
+ id: z.optional(z.number().int()),
13
+ type: z.literal('typeA'),
14
+ name: z.string(),
15
+ createdAt: z.optional(z.date()),
16
+ }),
17
+ ),
18
+ z
19
+ .lazy(() => itemTypeB)
20
+ .and(
21
+ z.object({
22
+ id: z.optional(z.number().int()),
23
+ type: z.literal('typeB'),
24
+ name: z.string(),
25
+ createdAt: z.optional(z.date()),
26
+ }),
27
+ ),
28
+ ])
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import { z } from 'zod'
6
+
7
+ /**
8
+ * @description Success
9
+ */
10
+ export const updateItem200 = z.lazy(() => item)
11
+
12
+ /**
13
+ * @description Item to update
14
+ */
15
+ export const updateItemMutationRequest = z.union([
16
+ z
17
+ .lazy(() => itemTypeA)
18
+ .and(
19
+ z.object({
20
+ name: z.string(),
21
+ type: z.literal('typeA'),
22
+ }),
23
+ ),
24
+ z
25
+ .lazy(() => itemTypeB)
26
+ .and(
27
+ z.object({
28
+ name: z.string(),
29
+ type: z.literal('typeB'),
30
+ }),
31
+ ),
32
+ ])
33
+
34
+ export const updateItemMutationResponse = z.lazy(() => updateItem200)
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import { z } from '@hono/zod-openapi'
6
+
7
+ /**
8
+ * @description Success
9
+ */
10
+ export const updateItem200 = z.lazy(() => item)
11
+
12
+ /**
13
+ * @description Item to update
14
+ */
15
+ export const updateItemMutationRequest = z.union([
16
+ z
17
+ .lazy(() => itemTypeA)
18
+ .and(
19
+ z.object({
20
+ name: z.string(),
21
+ type: z.literal('typeA'),
22
+ }),
23
+ ),
24
+ z
25
+ .lazy(() => itemTypeB)
26
+ .and(
27
+ z.object({
28
+ name: z.string(),
29
+ type: z.literal('typeB'),
30
+ }),
31
+ ),
32
+ ])
33
+
34
+ export const updateItemMutationResponse = z.lazy(() => updateItem200)
@@ -40,7 +40,27 @@ export const zodGenerator = createReactGenerator<PluginZod>({
40
40
  .flat()
41
41
  .filter(Boolean)
42
42
 
43
- const mapOperationSchema = ({ name, schema: schemaObject, description, keysToOmit, ...options }: OperationSchemaType) => {
43
+ const mapOperationSchema = ({ name, schema: schemaOriginal, description, keysToOmit: keysToOmitOriginal, ...options }: OperationSchemaType) => {
44
+ let schemaObject = schemaOriginal
45
+ let keysToOmit = keysToOmitOriginal
46
+
47
+ if ((schemaOriginal.anyOf || schemaOriginal.oneOf) && keysToOmitOriginal && keysToOmitOriginal.length > 0) {
48
+ schemaObject = structuredClone(schemaOriginal)
49
+
50
+ // Remove $ref so the schema parser generates inline schema instead of a reference
51
+ delete schemaObject.$ref
52
+
53
+ for (const key of keysToOmitOriginal) {
54
+ delete schemaObject.properties?.[key]
55
+ }
56
+
57
+ if (Array.isArray(schemaObject.required)) {
58
+ schemaObject.required = schemaObject.required.filter((key) => !keysToOmitOriginal.includes(key))
59
+ }
60
+
61
+ keysToOmit = undefined
62
+ }
63
+
44
64
  const hasProperties = Object.keys(schemaObject || {}).length > 0
45
65
  const hasDefaults = Object.values(schemaObject.properties || {}).some((prop) => prop && Object.hasOwn(prop, 'default'))
46
66
 
package/src/types.ts CHANGED
@@ -10,7 +10,7 @@ export type Options = {
10
10
  output?: Output<Oas>
11
11
  /**
12
12
  * Define which contentType should be used.
13
- * By default, the first JSON valid mediaType will be used
13
+ * By default, the first JSON valid mediaType is used
14
14
  */
15
15
  contentType?: contentType
16
16
  /**
@@ -31,26 +31,37 @@ export type Options = {
31
31
  override?: Array<Override<ResolvedOptions>>
32
32
  /**
33
33
  * Path to Zod
34
- * It will be used as `import { z } from '${importPath}'`.
35
- * It allows both relative and absolute path.
36
- * the path will be applied as is, so relative path should be based on the file being generated.
34
+ * It used as `import { z } from '${importPath}'`.
35
+ * Accepts relative and absolute paths.
36
+ * Path is used as-is; relative paths are based on the generated file location.
37
37
  * @default 'zod'
38
38
  */
39
39
  importPath?: string
40
40
 
41
41
  /**
42
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
43
- * False will fallback on a simple z.string() format
44
- * @default 'string' 'stringOffset' will become the default in Kubb v3
42
+ * Choose to use date or datetime as JavaScript Date instead of string.
43
+ * - false falls back to a simple z.string() format.
44
+ * - 'string' uses z.string().datetime() for datetime validation.
45
+ * - 'stringOffset' uses z.string().datetime({ offset: true }) for datetime with timezone offset validation.
46
+ * - 'stringLocal' uses z.string().datetime({ local: true }) for local datetime validation.
47
+ * - 'date' uses z.date() for JavaScript Date objects.
48
+ * @default 'string'
49
+ * @note 'stringOffset' will become the default in Kubb v3.
45
50
  */
46
51
  dateType?: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'
47
52
  /**
48
- * Which type to use when the Swagger/OpenAPI file is not providing more information
53
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
54
+ * - 'any' allows any value.
55
+ * - 'unknown' requires type narrowing before use.
56
+ * - 'void' represents no value.
49
57
  * @default 'any'
50
58
  */
51
59
  unknownType?: 'any' | 'unknown' | 'void'
52
60
  /**
53
- * Which type to use for empty schema values
61
+ * Which type to use for empty schema values.
62
+ * - 'any' allows any value.
63
+ * - 'unknown' requires type narrowing before use.
64
+ * - 'void' represents no value.
54
65
  * @default `unknownType`
55
66
  */
56
67
  emptySchemaType?: 'any' | 'unknown' | 'void'
@@ -81,7 +92,7 @@ export type Options = {
81
92
  */
82
93
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
83
94
  /**
84
- * Receive schema and baseName(propertName) and return FakerMeta array
95
+ * Receive schema and baseName(propertyName) and return FakerMeta array
85
96
  * TODO TODO add docs
86
97
  * @beta
87
98
  */
@@ -95,14 +106,16 @@ export type Options = {
95
106
  ) => Schema[] | undefined
96
107
  }
97
108
  /**
98
- * Which version of Zod should be used
99
- * @default '3
109
+ * Which version of Zod should be used.
110
+ * - '3' uses Zod v3.x syntax and features.
111
+ * - '4' uses Zod v4.x syntax and features.
112
+ * @default '3'
100
113
  */
101
114
  version?: '3' | '4'
102
115
  /**
103
116
  * Use Zod Mini's functional API for better tree-shaking support.
104
117
  * When enabled, generates functional syntax (e.g., `z.optional(z.string())`) instead of chainable methods (e.g., `z.string().optional()`).
105
- * Requires Zod v4 or later. When `mini: true`, `version` will be set to '4' and `importPath` will default to 'zod/mini'.
118
+ * Requires Zod v4 or later. When `mini: true`, `version` is set to '4' and `importPath` will default to 'zod/mini'.
106
119
  * @default false
107
120
  */
108
121
  mini?: boolean