@kubb/plugin-ts 4.18.4 → 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.
@@ -39,7 +39,7 @@ declare class Oas extends BaseOas {
39
39
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
40
40
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
41
41
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
42
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
42
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
43
43
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
44
44
  }
45
45
  //#endregion
@@ -341,7 +341,7 @@ type Config<TInput = Input> = {
341
341
  input: TInput;
342
342
  output: {
343
343
  /**
344
- * The path where all generated files will be exported.
344
+ * The path where all generated files receives exported.
345
345
  * This can be an absolute path or a path relative to the specified root option.
346
346
  */
347
347
  path: string;
@@ -356,41 +356,39 @@ type Config<TInput = Input> = {
356
356
  write?: boolean;
357
357
  /**
358
358
  * Specifies the formatting tool to be used.
359
- * @default prettier
360
- *
361
- * Possible values:
362
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
363
- * - 'prettier': Uses Prettier for code formatting.
364
- * - 'biome': Uses Biome for code formatting.
365
- *
359
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
360
+ * - 'prettier' uses Prettier for code formatting.
361
+ * - 'biome' uses Biome for code formatting.
362
+ * - 'oxfmt' uses Oxfmt for code formatting.
363
+ * - false disables code formatting.
364
+ * @default 'prettier'
366
365
  */
367
366
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
368
367
  /**
369
368
  * Specifies the linter that should be used to analyze the code.
370
- * The accepted values indicate different linting tools.
371
- *
372
- * Possible values:
373
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
374
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
375
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
376
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
377
- *
369
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
370
+ * - 'eslint' uses ESLint for linting.
371
+ * - 'biome' uses Biome for linting.
372
+ * - 'oxlint' uses Oxlint for linting.
373
+ * - false disables linting.
374
+ * @default 'auto'
378
375
  */
379
376
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
380
377
  /**
381
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
378
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
382
379
  * @default { '.ts': '.ts'}
383
380
  */
384
381
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
385
382
  /**
386
- * 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`.
383
+ * 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`).
387
384
  * @default 'named'
388
385
  */
389
386
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
390
387
  /**
391
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
392
- * - 'simple': will only add banner with link to Kubb
393
- * - 'full': will add source, title, description and the OpenAPI version used
388
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
389
+ * - 'simple' adds banner with link to Kubb.
390
+ * - 'full' adds source, title, description, and OpenAPI version.
391
+ * - false disables banner generation.
394
392
  * @default 'simple'
395
393
  */
396
394
  defaultBanner?: 'simple' | 'full' | false;
@@ -403,17 +401,17 @@ type Config<TInput = Input> = {
403
401
  override?: boolean;
404
402
  };
405
403
  /**
406
- * An array of Kubb plugins that will be used in the generation.
404
+ * An array of Kubb plugins that used in the generation.
407
405
  * Each plugin may include additional configurable options(defined in the plugin itself).
408
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
406
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
409
407
  */
410
408
  plugins?: Array<Plugin>;
411
409
  /**
412
- * Hooks that will be called when a specific action is triggered in Kubb.
410
+ * Hooks triggered when a specific action occurs in Kubb.
413
411
  */
414
412
  hooks?: {
415
413
  /**
416
- * Hook that will be triggered at the end of all executions.
414
+ * Hook that triggers at the end of all executions.
417
415
  * Useful for running Prettier or ESLint to format/lint your code.
418
416
  */
419
417
  done?: string | Array<string>;
@@ -442,7 +440,7 @@ TContext = any,
442
440
  TResolvePathOptions extends object = object> = {
443
441
  name: TName;
444
442
  /**
445
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
443
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
446
444
  */
447
445
  key: PluginKey<TName | string>;
448
446
  options: TOptions;
@@ -463,12 +461,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
463
461
  */
464
462
  options: TOptions['resolvedOptions'];
465
463
  /**
466
- * 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.
464
+ * 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.
467
465
  * Can be used to validate dependent plugins.
468
466
  */
469
467
  pre?: Array<string>;
470
468
  /**
471
- * 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.
469
+ * 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.
472
470
  */
473
471
  post?: Array<string>;
474
472
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -486,12 +484,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
486
484
  */
487
485
  key: TOptions['key'];
488
486
  /**
489
- * 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.
487
+ * 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.
490
488
  * Can be used to validate dependent plugins.
491
489
  */
492
490
  pre?: Array<string>;
493
491
  /**
494
- * 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.
492
+ * 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.
495
493
  */
496
494
  post?: Array<string>;
497
495
  /**
@@ -541,10 +539,12 @@ type ResolveNameParams = {
541
539
  name: string;
542
540
  pluginKey?: Plugin['key'];
543
541
  /**
544
- * `file` will be used to customize the name of the created file(use of camelCase)
545
- * `function` can be used to customize the exported functions(use of camelCase)
546
- * `type` is a special type for TypeScript(use of PascalCase)
547
- * `const` can be used for variables(use of camelCase)
542
+ * Specifies the type of entity being named.
543
+ * - 'file' customizes the name of the created file (uses camelCase).
544
+ * - 'function' customizes the exported function names (uses camelCase).
545
+ * - 'type' customizes TypeScript types (uses PascalCase).
546
+ * - 'const' customizes variable names (uses camelCase).
547
+ * @default undefined
548
548
  */
549
549
  type?: 'file' | 'function' | 'type' | 'const';
550
550
  };
@@ -599,11 +599,14 @@ type GroupContext = {
599
599
  };
600
600
  type Group = {
601
601
  /**
602
- * Define a type where to group the files on
602
+ * Defines the type where to group the files.
603
+ * - 'tag' groups files by OpenAPI tags.
604
+ * - 'path' groups files by OpenAPI paths.
605
+ * @default undefined
603
606
  */
604
607
  type: 'tag' | 'path';
605
608
  /**
606
- * Return the name of a group based on the group name, this will be used for the file and name generation
609
+ * Return the name of a group based on the group name, this used for the file and name generation
607
610
  */
608
611
  name?: (context: GroupContext) => string;
609
612
  };
@@ -675,7 +678,7 @@ declare class PluginManager {
675
678
  parameters: PluginParameter<H>;
676
679
  }): Array<ReturnType<ParseResult<H>>> | null;
677
680
  /**
678
- * First non-null result stops and will return it's value.
681
+ * Returns the first non-null result.
679
682
  */
680
683
  hookFirst<H extends PluginLifecycleHooks>({
681
684
  hookName,
@@ -687,7 +690,7 @@ declare class PluginManager {
687
690
  skipped?: ReadonlySet<Plugin> | null;
688
691
  }): Promise<SafeParseResult<H>>;
689
692
  /**
690
- * First non-null result stops and will return it's value.
693
+ * Returns the first non-null result.
691
694
  */
692
695
  hookFirstSync<H extends PluginLifecycleHooks>({
693
696
  hookName,
@@ -699,15 +702,15 @@ declare class PluginManager {
699
702
  skipped?: ReadonlySet<Plugin> | null;
700
703
  }): SafeParseResult<H>;
701
704
  /**
702
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
705
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
703
706
  */
704
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
707
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
705
708
  hookName,
706
709
  parameters
707
710
  }: {
708
711
  hookName: H;
709
712
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
710
- }): Promise<Awaited<TOuput>[]>;
713
+ }): Promise<Awaited<TOutput>[]>;
711
714
  /**
712
715
  * Chains plugins
713
716
  */
@@ -976,8 +979,8 @@ type SchemaKeywordMapper = {
976
979
  */
977
980
  path: KubbFile.Path;
978
981
  /**
979
- * When true `File.Import` will be used.
980
- * When false a reference will be used inside the current file.
982
+ * When true `File.Import` is used.
983
+ * When false a reference is used inside the current file.
981
984
  */
982
985
  isImportable: boolean;
983
986
  };
@@ -1109,7 +1112,7 @@ type SchemaGeneratorOptions = {
1109
1112
  */
1110
1113
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1111
1114
  /**
1112
- * Receive schema and name(propertName) and return FakerMeta array
1115
+ * Receive schema and name(propertyName) and return FakerMeta array
1113
1116
  * TODO TODO add docs
1114
1117
  * @beta
1115
1118
  */
@@ -1188,7 +1191,7 @@ type Options = {
1188
1191
  output?: Output<Oas>;
1189
1192
  /**
1190
1193
  * Define which contentType should be used.
1191
- * By default, the first JSON valid mediaType will be used
1194
+ * By default, uses the first valid JSON media type.
1192
1195
  */
1193
1196
  contentType?: contentType;
1194
1197
  /**
@@ -1208,29 +1211,31 @@ type Options = {
1208
1211
  */
1209
1212
  override?: Array<Override<ResolvedOptions>>;
1210
1213
  /**
1211
- * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, `literal`, or `inlineLiteral` for enums.
1212
- * - `enum`: TypeScript enum
1213
- * - `asConst`: const with camelCase name (e.g., `petType`)
1214
- * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)
1215
- * - `constEnum`: const enum
1216
- * - `literal`: literal union type
1217
- * - `inlineLiteral`: inline enum values directly into the type (default in v5)
1214
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
1215
+ * - 'enum' generates TypeScript enum declarations.
1216
+ * - 'asConst' generates const objects with camelCase names and as const assertion.
1217
+ * - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
1218
+ * - 'constEnum' generates TypeScript const enum declarations.
1219
+ * - 'literal' generates literal union types.
1220
+ * - 'inlineLiteral' inlines enum values directly into the type (default in v5).
1218
1221
  * @default 'asConst'
1219
- * @note In Kubb v5, `inlineLiteral` will become the default.
1222
+ * @note In Kubb v5, 'inlineLiteral' becomes the default.
1220
1223
  */
1221
1224
  enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
1222
1225
  /**
1223
1226
  * Choose the casing for enum key names.
1224
- * - `'screamingSnakeCase'`: ENUM_VALUE
1225
- * - `'snakeCase'`: enum_value
1226
- * - `'pascalCase'`: EnumValue
1227
- * - `'camelCase'`: enumValue
1228
- * - `'none'`: Uses the enum value as-is
1227
+ * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
1228
+ * - 'snakeCase' generates keys in snake_case format.
1229
+ * - 'pascalCase' generates keys in PascalCase format.
1230
+ * - 'camelCase' generates keys in camelCase format.
1231
+ * - 'none' uses the enum value as-is without transformation.
1229
1232
  * @default 'none'
1230
1233
  */
1231
1234
  enumKeyCasing?: 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
1232
1235
  /**
1233
- * Switch between type or interface for creating TypeScript types
1236
+ * Switch between type or interface for creating TypeScript types.
1237
+ * - 'type' generates type alias declarations.
1238
+ * - 'interface' generates interface declarations.
1234
1239
  * @default 'type'
1235
1240
  */
1236
1241
  syntaxType?: 'type' | 'interface';
@@ -1240,32 +1245,40 @@ type Options = {
1240
1245
  */
1241
1246
  enumSuffix?: string;
1242
1247
  /**
1243
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
1248
+ * Choose to use date or datetime as JavaScript Date instead of string.
1249
+ * - 'string' represents dates as string values.
1250
+ * - 'date' represents dates as JavaScript Date objects.
1244
1251
  * @default 'string'
1245
1252
  */
1246
1253
  dateType?: 'string' | 'date';
1247
1254
  /**
1248
1255
  * Which type to use when the Swagger/OpenAPI file is not providing more information.
1256
+ * - 'any' allows any value.
1257
+ * - 'unknown' requires type narrowing before use.
1258
+ * - 'void' represents no value.
1249
1259
  * @default 'any'
1250
1260
  */
1251
1261
  unknownType?: 'any' | 'unknown' | 'void';
1252
1262
  /**
1253
- * Which type to use for empty schema values
1263
+ * Which type to use for empty schema values.
1264
+ * - 'any' allows any value.
1265
+ * - 'unknown' requires type narrowing before use.
1266
+ * - 'void' represents no value.
1254
1267
  * @default `unknownType`
1255
1268
  */
1256
1269
  emptySchemaType?: 'any' | 'unknown' | 'void';
1257
1270
  /**
1258
1271
  * Choose what to use as mode for an optional value.
1259
- * @examples 'questionToken': type?: string
1260
- * @examples 'undefined': type: string | undefined
1261
- * @examples 'questionTokenAndUndefined': type?: string | undefined
1272
+ * - 'questionToken' marks the property as optional with ? (e.g., type?: string).
1273
+ * - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
1274
+ * - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
1262
1275
  * @default 'questionToken'
1263
1276
  */
1264
1277
  optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
1265
1278
  /**
1266
- * Choose between `Array<string>` or `string[]` for array types.
1267
- * - `generic`: Array<Type>
1268
- * - `array`: Type[]
1279
+ * Choose between Array<string> or string[] for array types.
1280
+ * - 'generic' generates Array<Type> syntax.
1281
+ * - 'array' generates Type[] syntax.
1269
1282
  * @default 'array'
1270
1283
  */
1271
1284
  arrayType?: 'generic' | 'array';
@@ -1314,4 +1327,4 @@ type ResolvedOptions = {
1314
1327
  type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>;
1315
1328
  //#endregion
1316
1329
  export { UserPluginWithLifeCycle as a, Schema as i, PluginTs as n, SchemaObject$1 as o, ReactGenerator as r, __name as s, Options as t };
1317
- //# sourceMappingURL=types-BmA-vXVc.d.cts.map
1330
+ //# sourceMappingURL=types-BMfQRWAb.d.cts.map