import * as _kubb_core from '@kubb/core'; import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core'; import * as KubbFile from '@kubb/fs/types'; import { ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas'; import { ts } from '@kubb/parser-ts'; type Options = { output?: { /** * Relative path to save the TypeScript types. * When output is a file it will save all models inside that file else it will create a file per schema item. * @default 'types' */ path: string; /** * Name to be used for the `export * as {{exportAs}} from './'` */ exportAs?: string; /** * Add an extension to the generated imports and exports, default it will not use an extension */ extName?: KubbFile.Extname; /** * Define what needs to exported, here you can also disable the export of barrel files * @default `'barrel'` */ exportType?: 'barrel' | 'barrelNamed' | false; }; /** * Group the TypeScript types based on the provided name. */ group?: { /** * Tag will group based on the operation tag inside the Swagger file. */ type: 'tag'; /** * Relative path to save the grouped TypeScript Types. * * `{{tag}}` will be replaced by the current tagName. * @example `${output}/{{tag}}Controller` => `models/PetController` * @default `${output}/{{tag}}Controller` */ output?: string; }; /** * Array containing exclude parameters to exclude/skip tags/operations/methods/paths. */ exclude?: Array; /** * Array containing include parameters to include tags/operations/methods/paths. */ include?: Array; /** * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array>; /** * Choose to use `enum` or `as const` for enums * @default 'asConst' */ enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'; /** * Set a suffix for the generated enums. * @default '' * Default will be `'enum'` in version 3 of Kubb */ enumSuffix?: string; /** * Choose to use `date` or `datetime` as JavaScript `Date` instead of `string`. * @default 'string' */ dateType?: 'string' | 'date'; /** * Which type to use when the Swagger/OpenAPI file is not providing more information. * @default 'any' */ unknownType?: 'any' | 'unknown'; /** * Choose what to use as mode for an optional value. * @examples 'questionToken': type?: string * @examples 'undefined': type: string | undefined * @examples 'questionTokenAndUndefined': type?: string | undefined * @default 'questionToken' */ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'; transformers?: { /** * Customize the names based on the type that is provided by the plugin. */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string; }; /** * Export an Oas object as Oas type with `import type { Infer } from '@kubb/swagger-ts/oas'` */ oasType?: 'infer' | false; /** * @example * Use https://ts-ast-viewer.com to generate factory code(see createPropertySignature) * category: factory.createPropertySignature( * undefined, * factory.createIdentifier("category"), * factory.createToken(ts.SyntaxKind.QuestionToken), * factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword) * ) */ mapper?: Record; }; type ResolvedOptions = { extName: KubbFile.Extname | undefined; enumType: NonNullable; enumSuffix: NonNullable; dateType: NonNullable; unknownType: NonNullable; optionalType: NonNullable; override: NonNullable; transformers: NonNullable; oasType: NonNullable; usedEnumNames: Record; mapper: Record; }; type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions>; declare module '@kubb/core' { interface _Register { ['@kubb/swagger-ts']: PluginTs; } } declare const pluginTsName = "plugin-ts"; declare const pluginTs: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle; /** * @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead */ declare const definePluginDefault: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle; /** * @deprecated Use `import { pluginTs } from '@kubb/swagger-ts'` instead */ declare const definePlugin: (options?: Options | undefined) => _kubb_core.UserPluginWithLifeCycle; export { type PluginTs, definePluginDefault as default, definePlugin, pluginTs, pluginTsName };