@kubb/plugin-faker 4.18.4 → 4.19.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.
@@ -1,4 +1,4 @@
1
- import { i as Schema, n as PluginFaker, o as __name } from "./types-BbUEWsa-.cjs";
1
+ import { i as Schema, n as PluginFaker, o as __name } from "./types-6bz8hJYn.cjs";
2
2
  import { KubbNode } from "@kubb/react-fabric/types";
3
3
 
4
4
  //#region src/components/Faker.d.ts
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { i as Schema, n as PluginFaker } from "./types-9jHhHEc_.js";
2
+ import { i as Schema, n as PluginFaker } from "./types-CFNdrwnB.js";
3
3
  import { KubbNode } from "@kubb/react-fabric/types";
4
4
 
5
5
  //#region src/components/Faker.d.ts
@@ -1,4 +1,4 @@
1
- import { n as PluginFaker, o as __name, r as ReactGenerator } from "./types-BbUEWsa-.cjs";
1
+ import { n as PluginFaker, o as __name, r as ReactGenerator } from "./types-6bz8hJYn.cjs";
2
2
 
3
3
  //#region src/generators/fakerGenerator.d.ts
4
4
  declare const fakerGenerator: ReactGenerator<PluginFaker>;
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { n as PluginFaker, r as ReactGenerator } from "./types-9jHhHEc_.js";
2
+ import { n as PluginFaker, r as ReactGenerator } from "./types-CFNdrwnB.js";
3
3
 
4
4
  //#region src/generators/fakerGenerator.d.ts
5
5
  declare const fakerGenerator: ReactGenerator<PluginFaker>;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginFaker, o as __name, t as Options } from "./types-BbUEWsa-.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginFaker, o as __name, t as Options } from "./types-6bz8hJYn.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginFakerName = "plugin-faker";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-9jHhHEc_.js";
2
+ import { a as UserPluginWithLifeCycle, n as PluginFaker, t as Options } from "./types-CFNdrwnB.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginFakerName = "plugin-faker";
@@ -306,7 +306,7 @@ type Config<TInput = Input> = {
306
306
  input: TInput;
307
307
  output: {
308
308
  /**
309
- * The path where all generated files will be exported.
309
+ * The path where all generated files receives exported.
310
310
  * This can be an absolute path or a path relative to the specified root option.
311
311
  */
312
312
  path: string;
@@ -321,41 +321,39 @@ type Config<TInput = Input> = {
321
321
  write?: boolean;
322
322
  /**
323
323
  * Specifies the formatting tool to be used.
324
- * @default prettier
325
- *
326
- * Possible values:
327
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
328
- * - 'prettier': Uses Prettier for code formatting.
329
- * - 'biome': Uses Biome for code formatting.
330
- *
324
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
325
+ * - 'prettier' uses Prettier for code formatting.
326
+ * - 'biome' uses Biome for code formatting.
327
+ * - 'oxfmt' uses Oxfmt for code formatting.
328
+ * - false disables code formatting.
329
+ * @default 'prettier'
331
330
  */
332
331
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
333
332
  /**
334
333
  * Specifies the linter that should be used to analyze the code.
335
- * The accepted values indicate different linting tools.
336
- *
337
- * Possible values:
338
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
339
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
340
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
341
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
342
- *
334
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
335
+ * - 'eslint' uses ESLint for linting.
336
+ * - 'biome' uses Biome for linting.
337
+ * - 'oxlint' uses Oxlint for linting.
338
+ * - false disables linting.
339
+ * @default 'auto'
343
340
  */
344
341
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
345
342
  /**
346
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
343
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
347
344
  * @default { '.ts': '.ts'}
348
345
  */
349
346
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
350
347
  /**
351
- * 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`.
348
+ * 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`).
352
349
  * @default 'named'
353
350
  */
354
351
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
355
352
  /**
356
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
357
- * - 'simple': will only add banner with link to Kubb
358
- * - 'full': will add source, title, description and the OpenAPI version used
353
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
354
+ * - 'simple' adds banner with link to Kubb.
355
+ * - 'full' adds source, title, description, and OpenAPI version.
356
+ * - false disables banner generation.
359
357
  * @default 'simple'
360
358
  */
361
359
  defaultBanner?: 'simple' | 'full' | false;
@@ -368,17 +366,17 @@ type Config<TInput = Input> = {
368
366
  override?: boolean;
369
367
  };
370
368
  /**
371
- * An array of Kubb plugins that will be used in the generation.
369
+ * An array of Kubb plugins that used in the generation.
372
370
  * Each plugin may include additional configurable options(defined in the plugin itself).
373
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
371
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
374
372
  */
375
373
  plugins?: Array<Plugin>;
376
374
  /**
377
- * Hooks that will be called when a specific action is triggered in Kubb.
375
+ * Hooks triggered when a specific action occurs in Kubb.
378
376
  */
379
377
  hooks?: {
380
378
  /**
381
- * Hook that will be triggered at the end of all executions.
379
+ * Hook that triggers at the end of all executions.
382
380
  * Useful for running Prettier or ESLint to format/lint your code.
383
381
  */
384
382
  done?: string | Array<string>;
@@ -407,7 +405,7 @@ TContext = any,
407
405
  TResolvePathOptions extends object = object> = {
408
406
  name: TName;
409
407
  /**
410
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
408
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
411
409
  */
412
410
  key: PluginKey<TName | string>;
413
411
  options: TOptions;
@@ -428,12 +426,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
428
426
  */
429
427
  options: TOptions['resolvedOptions'];
430
428
  /**
431
- * 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.
429
+ * 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.
432
430
  * Can be used to validate dependent plugins.
433
431
  */
434
432
  pre?: Array<string>;
435
433
  /**
436
- * 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.
434
+ * 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.
437
435
  */
438
436
  post?: Array<string>;
439
437
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -451,12 +449,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
451
449
  */
452
450
  key: TOptions['key'];
453
451
  /**
454
- * 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.
452
+ * 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.
455
453
  * Can be used to validate dependent plugins.
456
454
  */
457
455
  pre?: Array<string>;
458
456
  /**
459
- * 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.
457
+ * 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.
460
458
  */
461
459
  post?: Array<string>;
462
460
  /**
@@ -506,10 +504,12 @@ type ResolveNameParams = {
506
504
  name: string;
507
505
  pluginKey?: Plugin['key'];
508
506
  /**
509
- * `file` will be used to customize the name of the created file(use of camelCase)
510
- * `function` can be used to customize the exported functions(use of camelCase)
511
- * `type` is a special type for TypeScript(use of PascalCase)
512
- * `const` can be used for variables(use of camelCase)
507
+ * Specifies the type of entity being named.
508
+ * - 'file' customizes the name of the created file (uses camelCase).
509
+ * - 'function' customizes the exported function names (uses camelCase).
510
+ * - 'type' customizes TypeScript types (uses PascalCase).
511
+ * - 'const' customizes variable names (uses camelCase).
512
+ * @default undefined
513
513
  */
514
514
  type?: 'file' | 'function' | 'type' | 'const';
515
515
  };
@@ -564,11 +564,14 @@ type GroupContext = {
564
564
  };
565
565
  type Group = {
566
566
  /**
567
- * Define a type where to group the files on
567
+ * Defines the type where to group the files.
568
+ * - 'tag' groups files by OpenAPI tags.
569
+ * - 'path' groups files by OpenAPI paths.
570
+ * @default undefined
568
571
  */
569
572
  type: 'tag' | 'path';
570
573
  /**
571
- * Return the name of a group based on the group name, this will be used for the file and name generation
574
+ * Return the name of a group based on the group name, this used for the file and name generation
572
575
  */
573
576
  name?: (context: GroupContext) => string;
574
577
  };
@@ -581,7 +584,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
581
584
  result: Result;
582
585
  plugin: Plugin;
583
586
  };
584
- type Options$2 = {
587
+ type Options$1 = {
585
588
  fabric: Fabric;
586
589
  events: AsyncEventEmitter<KubbEvents>;
587
590
  /**
@@ -599,8 +602,8 @@ type GetFileProps<TOptions = object> = {
599
602
  declare class PluginManager {
600
603
  #private;
601
604
  readonly config: Config;
602
- readonly options: Options$2;
603
- constructor(config: Config, options: Options$2);
605
+ readonly options: Options$1;
606
+ constructor(config: Config, options: Options$1);
604
607
  get events(): AsyncEventEmitter<KubbEvents>;
605
608
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
606
609
  get plugins(): Array<Plugin>;
@@ -640,7 +643,7 @@ declare class PluginManager {
640
643
  parameters: PluginParameter<H>;
641
644
  }): Array<ReturnType<ParseResult<H>>> | null;
642
645
  /**
643
- * First non-null result stops and will return it's value.
646
+ * Returns the first non-null result.
644
647
  */
645
648
  hookFirst<H extends PluginLifecycleHooks>({
646
649
  hookName,
@@ -652,7 +655,7 @@ declare class PluginManager {
652
655
  skipped?: ReadonlySet<Plugin> | null;
653
656
  }): Promise<SafeParseResult<H>>;
654
657
  /**
655
- * First non-null result stops and will return it's value.
658
+ * Returns the first non-null result.
656
659
  */
657
660
  hookFirstSync<H extends PluginLifecycleHooks>({
658
661
  hookName,
@@ -664,15 +667,15 @@ declare class PluginManager {
664
667
  skipped?: ReadonlySet<Plugin> | null;
665
668
  }): SafeParseResult<H>;
666
669
  /**
667
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
670
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
668
671
  */
669
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
672
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
670
673
  hookName,
671
674
  parameters
672
675
  }: {
673
676
  hookName: H;
674
677
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
675
- }): Promise<Awaited<TOuput>[]>;
678
+ }): Promise<Awaited<TOutput>[]>;
676
679
  /**
677
680
  * Chains plugins
678
681
  */
@@ -704,16 +707,21 @@ type Operation$1 = Operation;
704
707
  type DiscriminatorObject$1 = DiscriminatorObject;
705
708
  //#endregion
706
709
  //#region ../oas/src/Oas.d.ts
707
- type Options$1 = {
710
+ type OasOptions = {
708
711
  contentType?: contentType;
709
712
  discriminator?: 'strict' | 'inherit';
713
+ /**
714
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
715
+ * @default false
716
+ */
717
+ collisionDetection?: boolean;
710
718
  };
711
719
  declare class Oas extends BaseOas {
712
720
  #private;
713
721
  document: Document;
714
722
  constructor(document: Document);
715
- setOptions(options: Options$1): void;
716
- get options(): Options$1;
723
+ setOptions(options: OasOptions): void;
724
+ get options(): OasOptions;
717
725
  get<T = unknown>($ref: string): T | null;
718
726
  getKey($ref: string): string | undefined;
719
727
  set($ref: string, value: unknown): false | undefined;
@@ -722,8 +730,20 @@ declare class Oas extends BaseOas {
722
730
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
723
731
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
724
732
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
725
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
733
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
726
734
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
735
+ /**
736
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
737
+ * Returns schemas in dependency order along with name mapping for collision resolution.
738
+ */
739
+ getSchemas(options?: {
740
+ contentType?: contentType;
741
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
742
+ collisionDetection?: boolean;
743
+ }): {
744
+ schemas: Record<string, SchemaObject$1>;
745
+ nameMapping: Map<string, string>;
746
+ };
727
747
  }
728
748
  //#endregion
729
749
  //#region ../plugin-oas/src/types.d.ts
@@ -975,8 +995,8 @@ type SchemaKeywordMapper = {
975
995
  */
976
996
  path: KubbFile.Path;
977
997
  /**
978
- * When true `File.Import` will be used.
979
- * When false a reference will be used inside the current file.
998
+ * When true `File.Import` is used.
999
+ * When false a reference is used inside the current file.
980
1000
  */
981
1001
  isImportable: boolean;
982
1002
  };
@@ -1108,7 +1128,7 @@ type SchemaGeneratorOptions = {
1108
1128
  */
1109
1129
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1110
1130
  /**
1111
- * Receive schema and name(propertName) and return FakerMeta array
1131
+ * Receive schema and name(propertyName) and return FakerMeta array
1112
1132
  * TODO TODO add docs
1113
1133
  * @beta
1114
1134
  */
@@ -1187,7 +1207,7 @@ type Options = {
1187
1207
  output?: Output<Oas>;
1188
1208
  /**
1189
1209
  * Define which contentType should be used.
1190
- * By default, the first JSON valid mediaType will be used
1210
+ * By default, the first JSON valid mediaType is used
1191
1211
  */
1192
1212
  contentType?: contentType;
1193
1213
  /**
@@ -1207,36 +1227,40 @@ type Options = {
1207
1227
  */
1208
1228
  override?: Array<Override<ResolvedOptions>>;
1209
1229
  /**
1210
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
1230
+ * Choose to use date or datetime as JavaScript Date instead of string.
1231
+ * - 'string' represents dates as string values.
1232
+ * - 'date' represents dates as JavaScript Date objects.
1211
1233
  * @default 'string'
1212
1234
  */
1213
1235
  dateType?: 'string' | 'date';
1214
1236
  /**
1215
- * Which parser should be used when dateType is set to 'string'.
1216
- * - Schema with format 'date' will use ISO date format (YYYY-MM-DD)
1217
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("YYYY-MM-DD")`.
1218
- * - `undefined` will use `faker.date.anytime().toString()`
1219
- * - Schema with format 'time' will use ISO time format (HH:mm:ss[.SSSSSS])
1220
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
1221
- * - `undefined` will use `faker.date.anytime().toString()`
1222
- * * @default 'faker'
1237
+ * Which parser should be used when dateType is set to string.
1238
+ * - 'faker' uses faker's built-in date formatting methods.
1239
+ * - 'dayjs' uses dayjs for date formatting with custom patterns.
1240
+ * - 'moment' uses moment for date formatting with custom patterns.
1241
+ * @default 'faker'
1223
1242
  */
1224
1243
  dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {});
1225
1244
  /**
1226
- * Which type to use when the Swagger/OpenAPI file is not providing more information
1245
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
1246
+ * - 'any' allows any value.
1247
+ * - 'unknown' requires type narrowing before use.
1248
+ * - 'void' represents no value.
1227
1249
  * @default 'any'
1228
1250
  */
1229
1251
  unknownType?: 'any' | 'unknown' | 'void';
1230
1252
  /**
1231
- * Which type to use for empty schema values
1253
+ * Which type to use for empty schema values.
1254
+ * - 'any' allows any value.
1255
+ * - 'unknown' requires type narrowing before use.
1256
+ * - 'void' represents no value.
1232
1257
  * @default `unknownType`
1233
1258
  */
1234
1259
  emptySchemaType?: 'any' | 'unknown' | 'void';
1235
1260
  /**
1236
1261
  * Choose which generator to use when using Regexp.
1237
- *
1238
- * `'faker'` will use `faker.helpers.fromRegExp(new RegExp(/test/))`
1239
- * `'randexp'` will use `new RandExp(/test/).gen()`
1262
+ * - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
1263
+ * - 'randexp' uses RandExp library for generating values from regex patterns.
1240
1264
  * @default 'faker'
1241
1265
  */
1242
1266
  regexGenerator?: 'faker' | 'randexp';
@@ -1251,7 +1275,7 @@ type Options = {
1251
1275
  */
1252
1276
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1253
1277
  /**
1254
- * Receive schema and baseName(propertName) and return FakerMeta array
1278
+ * Receive schema and baseName(propertyName) and return FakerMeta array
1255
1279
  * TODO TODO add docs
1256
1280
  * @beta
1257
1281
  */
@@ -1282,4 +1306,4 @@ type ResolvedOptions = {
1282
1306
  type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
1283
1307
  //#endregion
1284
1308
  export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, __name as o, ReactGenerator as r, Options as t };
1285
- //# sourceMappingURL=types-BbUEWsa-.d.cts.map
1309
+ //# sourceMappingURL=types-6bz8hJYn.d.cts.map
@@ -305,7 +305,7 @@ type Config<TInput = Input> = {
305
305
  input: TInput;
306
306
  output: {
307
307
  /**
308
- * The path where all generated files will be exported.
308
+ * The path where all generated files receives exported.
309
309
  * This can be an absolute path or a path relative to the specified root option.
310
310
  */
311
311
  path: string;
@@ -320,41 +320,39 @@ type Config<TInput = Input> = {
320
320
  write?: boolean;
321
321
  /**
322
322
  * Specifies the formatting tool to be used.
323
- * @default prettier
324
- *
325
- * Possible values:
326
- * - 'auto': Automatically detects and uses biome or prettier (in that order of preference).
327
- * - 'prettier': Uses Prettier for code formatting.
328
- * - 'biome': Uses Biome for code formatting.
329
- *
323
+ * - 'auto' automatically detects and uses biome or prettier (in that order of preference).
324
+ * - 'prettier' uses Prettier for code formatting.
325
+ * - 'biome' uses Biome for code formatting.
326
+ * - 'oxfmt' uses Oxfmt for code formatting.
327
+ * - false disables code formatting.
328
+ * @default 'prettier'
330
329
  */
331
330
  format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
332
331
  /**
333
332
  * Specifies the linter that should be used to analyze the code.
334
- * The accepted values indicate different linting tools.
335
- *
336
- * Possible values:
337
- * - 'auto': Automatically detects and uses biome, oxlint, or eslint (in that order of preference).
338
- * - 'eslint': Represents the use of ESLint, a widely used JavaScript linter.
339
- * - 'biome': Represents the Biome linter, a modern tool for code scanning.
340
- * - 'oxlint': Represents the Oxlint tool for linting purposes.
341
- *
333
+ * - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
334
+ * - 'eslint' uses ESLint for linting.
335
+ * - 'biome' uses Biome for linting.
336
+ * - 'oxlint' uses Oxlint for linting.
337
+ * - false disables linting.
338
+ * @default 'auto'
342
339
  */
343
340
  lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
344
341
  /**
345
- * Override the extension to the generated imports and exports, by default each plugin will add an extension
342
+ * Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
346
343
  * @default { '.ts': '.ts'}
347
344
  */
348
345
  extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
349
346
  /**
350
- * 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`.
347
+ * 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`).
351
348
  * @default 'named'
352
349
  */
353
350
  barrelType?: Exclude<BarrelType, 'propagate'> | false;
354
351
  /**
355
- * Add a default banner to the beginning of every generated file. This makes it clear that the file was generated by Kubb.
356
- * - 'simple': will only add banner with link to Kubb
357
- * - 'full': will add source, title, description and the OpenAPI version used
352
+ * Adds a default banner to the start of every generated file indicating it was generated by Kubb.
353
+ * - 'simple' adds banner with link to Kubb.
354
+ * - 'full' adds source, title, description, and OpenAPI version.
355
+ * - false disables banner generation.
358
356
  * @default 'simple'
359
357
  */
360
358
  defaultBanner?: 'simple' | 'full' | false;
@@ -367,17 +365,17 @@ type Config<TInput = Input> = {
367
365
  override?: boolean;
368
366
  };
369
367
  /**
370
- * An array of Kubb plugins that will be used in the generation.
368
+ * An array of Kubb plugins that used in the generation.
371
369
  * Each plugin may include additional configurable options(defined in the plugin itself).
372
- * If a plugin depends on another plugin, an error will be returned if the required dependency is missing. See pre for more details.
370
+ * If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
373
371
  */
374
372
  plugins?: Array<Plugin>;
375
373
  /**
376
- * Hooks that will be called when a specific action is triggered in Kubb.
374
+ * Hooks triggered when a specific action occurs in Kubb.
377
375
  */
378
376
  hooks?: {
379
377
  /**
380
- * Hook that will be triggered at the end of all executions.
378
+ * Hook that triggers at the end of all executions.
381
379
  * Useful for running Prettier or ESLint to format/lint your code.
382
380
  */
383
381
  done?: string | Array<string>;
@@ -406,7 +404,7 @@ TContext = any,
406
404
  TResolvePathOptions extends object = object> = {
407
405
  name: TName;
408
406
  /**
409
- * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
407
+ * Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
410
408
  */
411
409
  key: PluginKey<TName | string>;
412
410
  options: TOptions;
@@ -427,12 +425,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
427
425
  */
428
426
  options: TOptions['resolvedOptions'];
429
427
  /**
430
- * 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.
428
+ * 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.
431
429
  * Can be used to validate dependent plugins.
432
430
  */
433
431
  pre?: Array<string>;
434
432
  /**
435
- * 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.
433
+ * 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.
436
434
  */
437
435
  post?: Array<string>;
438
436
  inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
@@ -450,12 +448,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
450
448
  */
451
449
  key: TOptions['key'];
452
450
  /**
453
- * 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.
451
+ * 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.
454
452
  * Can be used to validate dependent plugins.
455
453
  */
456
454
  pre?: Array<string>;
457
455
  /**
458
- * 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.
456
+ * 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.
459
457
  */
460
458
  post?: Array<string>;
461
459
  /**
@@ -505,10 +503,12 @@ type ResolveNameParams = {
505
503
  name: string;
506
504
  pluginKey?: Plugin['key'];
507
505
  /**
508
- * `file` will be used to customize the name of the created file(use of camelCase)
509
- * `function` can be used to customize the exported functions(use of camelCase)
510
- * `type` is a special type for TypeScript(use of PascalCase)
511
- * `const` can be used for variables(use of camelCase)
506
+ * Specifies the type of entity being named.
507
+ * - 'file' customizes the name of the created file (uses camelCase).
508
+ * - 'function' customizes the exported function names (uses camelCase).
509
+ * - 'type' customizes TypeScript types (uses PascalCase).
510
+ * - 'const' customizes variable names (uses camelCase).
511
+ * @default undefined
512
512
  */
513
513
  type?: 'file' | 'function' | 'type' | 'const';
514
514
  };
@@ -563,11 +563,14 @@ type GroupContext = {
563
563
  };
564
564
  type Group = {
565
565
  /**
566
- * Define a type where to group the files on
566
+ * Defines the type where to group the files.
567
+ * - 'tag' groups files by OpenAPI tags.
568
+ * - 'path' groups files by OpenAPI paths.
569
+ * @default undefined
567
570
  */
568
571
  type: 'tag' | 'path';
569
572
  /**
570
- * Return the name of a group based on the group name, this will be used for the file and name generation
573
+ * Return the name of a group based on the group name, this used for the file and name generation
571
574
  */
572
575
  name?: (context: GroupContext) => string;
573
576
  };
@@ -580,7 +583,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
580
583
  result: Result;
581
584
  plugin: Plugin;
582
585
  };
583
- type Options$2 = {
586
+ type Options$1 = {
584
587
  fabric: Fabric;
585
588
  events: AsyncEventEmitter<KubbEvents>;
586
589
  /**
@@ -598,8 +601,8 @@ type GetFileProps<TOptions = object> = {
598
601
  declare class PluginManager {
599
602
  #private;
600
603
  readonly config: Config;
601
- readonly options: Options$2;
602
- constructor(config: Config, options: Options$2);
604
+ readonly options: Options$1;
605
+ constructor(config: Config, options: Options$1);
603
606
  get events(): AsyncEventEmitter<KubbEvents>;
604
607
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
605
608
  get plugins(): Array<Plugin>;
@@ -639,7 +642,7 @@ declare class PluginManager {
639
642
  parameters: PluginParameter<H>;
640
643
  }): Array<ReturnType<ParseResult<H>>> | null;
641
644
  /**
642
- * First non-null result stops and will return it's value.
645
+ * Returns the first non-null result.
643
646
  */
644
647
  hookFirst<H extends PluginLifecycleHooks>({
645
648
  hookName,
@@ -651,7 +654,7 @@ declare class PluginManager {
651
654
  skipped?: ReadonlySet<Plugin> | null;
652
655
  }): Promise<SafeParseResult<H>>;
653
656
  /**
654
- * First non-null result stops and will return it's value.
657
+ * Returns the first non-null result.
655
658
  */
656
659
  hookFirstSync<H extends PluginLifecycleHooks>({
657
660
  hookName,
@@ -663,15 +666,15 @@ declare class PluginManager {
663
666
  skipped?: ReadonlySet<Plugin> | null;
664
667
  }): SafeParseResult<H>;
665
668
  /**
666
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
669
+ * Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
667
670
  */
668
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
671
+ hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
669
672
  hookName,
670
673
  parameters
671
674
  }: {
672
675
  hookName: H;
673
676
  parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
674
- }): Promise<Awaited<TOuput>[]>;
677
+ }): Promise<Awaited<TOutput>[]>;
675
678
  /**
676
679
  * Chains plugins
677
680
  */
@@ -703,16 +706,21 @@ type Operation$1 = Operation;
703
706
  type DiscriminatorObject$1 = DiscriminatorObject;
704
707
  //#endregion
705
708
  //#region ../oas/src/Oas.d.ts
706
- type Options$1 = {
709
+ type OasOptions = {
707
710
  contentType?: contentType;
708
711
  discriminator?: 'strict' | 'inherit';
712
+ /**
713
+ * Resolve name collisions when schemas from different components share the same name (case-insensitive).
714
+ * @default false
715
+ */
716
+ collisionDetection?: boolean;
709
717
  };
710
718
  declare class Oas extends BaseOas {
711
719
  #private;
712
720
  document: Document;
713
721
  constructor(document: Document);
714
- setOptions(options: Options$1): void;
715
- get options(): Options$1;
722
+ setOptions(options: OasOptions): void;
723
+ get options(): OasOptions;
716
724
  get<T = unknown>($ref: string): T | null;
717
725
  getKey($ref: string): string | undefined;
718
726
  set($ref: string, value: unknown): false | undefined;
@@ -721,8 +729,20 @@ declare class Oas extends BaseOas {
721
729
  getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
722
730
  getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
723
731
  getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
724
- valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
732
+ validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
725
733
  flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
734
+ /**
735
+ * Get schemas from OpenAPI components (schemas, responses, requestBodies).
736
+ * Returns schemas in dependency order along with name mapping for collision resolution.
737
+ */
738
+ getSchemas(options?: {
739
+ contentType?: contentType;
740
+ includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
741
+ collisionDetection?: boolean;
742
+ }): {
743
+ schemas: Record<string, SchemaObject$1>;
744
+ nameMapping: Map<string, string>;
745
+ };
726
746
  }
727
747
  //#endregion
728
748
  //#region ../plugin-oas/src/types.d.ts
@@ -974,8 +994,8 @@ type SchemaKeywordMapper = {
974
994
  */
975
995
  path: KubbFile.Path;
976
996
  /**
977
- * When true `File.Import` will be used.
978
- * When false a reference will be used inside the current file.
997
+ * When true `File.Import` is used.
998
+ * When false a reference is used inside the current file.
979
999
  */
980
1000
  isImportable: boolean;
981
1001
  };
@@ -1107,7 +1127,7 @@ type SchemaGeneratorOptions = {
1107
1127
  */
1108
1128
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1109
1129
  /**
1110
- * Receive schema and name(propertName) and return FakerMeta array
1130
+ * Receive schema and name(propertyName) and return FakerMeta array
1111
1131
  * TODO TODO add docs
1112
1132
  * @beta
1113
1133
  */
@@ -1186,7 +1206,7 @@ type Options = {
1186
1206
  output?: Output<Oas>;
1187
1207
  /**
1188
1208
  * Define which contentType should be used.
1189
- * By default, the first JSON valid mediaType will be used
1209
+ * By default, the first JSON valid mediaType is used
1190
1210
  */
1191
1211
  contentType?: contentType;
1192
1212
  /**
@@ -1206,36 +1226,40 @@ type Options = {
1206
1226
  */
1207
1227
  override?: Array<Override<ResolvedOptions>>;
1208
1228
  /**
1209
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
1229
+ * Choose to use date or datetime as JavaScript Date instead of string.
1230
+ * - 'string' represents dates as string values.
1231
+ * - 'date' represents dates as JavaScript Date objects.
1210
1232
  * @default 'string'
1211
1233
  */
1212
1234
  dateType?: 'string' | 'date';
1213
1235
  /**
1214
- * Which parser should be used when dateType is set to 'string'.
1215
- * - Schema with format 'date' will use ISO date format (YYYY-MM-DD)
1216
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("YYYY-MM-DD")`.
1217
- * - `undefined` will use `faker.date.anytime().toString()`
1218
- * - Schema with format 'time' will use ISO time format (HH:mm:ss[.SSSSSS])
1219
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
1220
- * - `undefined` will use `faker.date.anytime().toString()`
1221
- * * @default 'faker'
1236
+ * Which parser should be used when dateType is set to string.
1237
+ * - 'faker' uses faker's built-in date formatting methods.
1238
+ * - 'dayjs' uses dayjs for date formatting with custom patterns.
1239
+ * - 'moment' uses moment for date formatting with custom patterns.
1240
+ * @default 'faker'
1222
1241
  */
1223
1242
  dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {});
1224
1243
  /**
1225
- * Which type to use when the Swagger/OpenAPI file is not providing more information
1244
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
1245
+ * - 'any' allows any value.
1246
+ * - 'unknown' requires type narrowing before use.
1247
+ * - 'void' represents no value.
1226
1248
  * @default 'any'
1227
1249
  */
1228
1250
  unknownType?: 'any' | 'unknown' | 'void';
1229
1251
  /**
1230
- * Which type to use for empty schema values
1252
+ * Which type to use for empty schema values.
1253
+ * - 'any' allows any value.
1254
+ * - 'unknown' requires type narrowing before use.
1255
+ * - 'void' represents no value.
1231
1256
  * @default `unknownType`
1232
1257
  */
1233
1258
  emptySchemaType?: 'any' | 'unknown' | 'void';
1234
1259
  /**
1235
1260
  * Choose which generator to use when using Regexp.
1236
- *
1237
- * `'faker'` will use `faker.helpers.fromRegExp(new RegExp(/test/))`
1238
- * `'randexp'` will use `new RandExp(/test/).gen()`
1261
+ * - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
1262
+ * - 'randexp' uses RandExp library for generating values from regex patterns.
1239
1263
  * @default 'faker'
1240
1264
  */
1241
1265
  regexGenerator?: 'faker' | 'randexp';
@@ -1250,7 +1274,7 @@ type Options = {
1250
1274
  */
1251
1275
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
1252
1276
  /**
1253
- * Receive schema and baseName(propertName) and return FakerMeta array
1277
+ * Receive schema and baseName(propertyName) and return FakerMeta array
1254
1278
  * TODO TODO add docs
1255
1279
  * @beta
1256
1280
  */
@@ -1281,4 +1305,4 @@ type ResolvedOptions = {
1281
1305
  type PluginFaker = PluginFactoryOptions<'plugin-faker', Options, ResolvedOptions, never, ResolvePathOptions>;
1282
1306
  //#endregion
1283
1307
  export { UserPluginWithLifeCycle as a, Schema as i, PluginFaker as n, ReactGenerator as r, Options as t };
1284
- //# sourceMappingURL=types-9jHhHEc_.d.ts.map
1308
+ //# sourceMappingURL=types-CFNdrwnB.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-faker",
3
- "version": "4.18.4",
3
+ "version": "4.19.0",
4
4
  "description": "Faker.js data generator plugin for Kubb, creating realistic mock data from OpenAPI specifications for development and testing.",
5
5
  "keywords": [
6
6
  "faker",
@@ -69,10 +69,10 @@
69
69
  ],
70
70
  "dependencies": {
71
71
  "@kubb/react-fabric": "0.12.4",
72
- "@kubb/core": "4.18.4",
73
- "@kubb/oas": "4.18.4",
74
- "@kubb/plugin-oas": "4.18.4",
75
- "@kubb/plugin-ts": "4.18.4"
72
+ "@kubb/core": "4.19.0",
73
+ "@kubb/oas": "4.19.0",
74
+ "@kubb/plugin-oas": "4.19.0",
75
+ "@kubb/plugin-ts": "4.19.0"
76
76
  },
77
77
  "engines": {
78
78
  "node": ">=20"
package/src/types.ts CHANGED
@@ -12,7 +12,7 @@ export type Options = {
12
12
  output?: Output<Oas>
13
13
  /**
14
14
  * Define which contentType should be used.
15
- * By default, the first JSON valid mediaType will be used
15
+ * By default, the first JSON valid mediaType is used
16
16
  */
17
17
  contentType?: contentType
18
18
  /**
@@ -32,36 +32,40 @@ export type Options = {
32
32
  */
33
33
  override?: Array<Override<ResolvedOptions>>
34
34
  /**
35
- * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`.
35
+ * Choose to use date or datetime as JavaScript Date instead of string.
36
+ * - 'string' represents dates as string values.
37
+ * - 'date' represents dates as JavaScript Date objects.
36
38
  * @default 'string'
37
39
  */
38
40
  dateType?: 'string' | 'date'
39
41
  /**
40
- * Which parser should be used when dateType is set to 'string'.
41
- * - Schema with format 'date' will use ISO date format (YYYY-MM-DD)
42
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("YYYY-MM-DD")`.
43
- * - `undefined` will use `faker.date.anytime().toString()`
44
- * - Schema with format 'time' will use ISO time format (HH:mm:ss[.SSSSSS])
45
- * - `'dayjs'` will use `dayjs(faker.date.anytime()).format("HH:mm:ss")`.
46
- * - `undefined` will use `faker.date.anytime().toString()`
47
- * * @default 'faker'
42
+ * Which parser should be used when dateType is set to string.
43
+ * - 'faker' uses faker's built-in date formatting methods.
44
+ * - 'dayjs' uses dayjs for date formatting with custom patterns.
45
+ * - 'moment' uses moment for date formatting with custom patterns.
46
+ * @default 'faker'
48
47
  */
49
48
  dateParser?: 'faker' | 'dayjs' | 'moment' | (string & {})
50
49
  /**
51
- * Which type to use when the Swagger/OpenAPI file is not providing more information
50
+ * Which type to use when the Swagger/OpenAPI file is not providing more information.
51
+ * - 'any' allows any value.
52
+ * - 'unknown' requires type narrowing before use.
53
+ * - 'void' represents no value.
52
54
  * @default 'any'
53
55
  */
54
56
  unknownType?: 'any' | 'unknown' | 'void'
55
57
  /**
56
- * Which type to use for empty schema values
58
+ * Which type to use for empty schema values.
59
+ * - 'any' allows any value.
60
+ * - 'unknown' requires type narrowing before use.
61
+ * - 'void' represents no value.
57
62
  * @default `unknownType`
58
63
  */
59
64
  emptySchemaType?: 'any' | 'unknown' | 'void'
60
65
  /**
61
66
  * Choose which generator to use when using Regexp.
62
- *
63
- * `'faker'` will use `faker.helpers.fromRegExp(new RegExp(/test/))`
64
- * `'randexp'` will use `new RandExp(/test/).gen()`
67
+ * - 'faker' uses faker.helpers.fromRegExp for generating values from regex patterns.
68
+ * - 'randexp' uses RandExp library for generating values from regex patterns.
65
69
  * @default 'faker'
66
70
  */
67
71
  regexGenerator?: 'faker' | 'randexp'
@@ -77,7 +81,7 @@ export type Options = {
77
81
  */
78
82
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
79
83
  /**
80
- * Receive schema and baseName(propertName) and return FakerMeta array
84
+ * Receive schema and baseName(propertyName) and return FakerMeta array
81
85
  * TODO TODO add docs
82
86
  * @beta
83
87
  */