@kubb/plugin-oas 5.0.0-alpha.32 → 5.0.0-alpha.33

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.
Files changed (39) hide show
  1. package/dist/{createGenerator-DIWR4PRm.d.ts → createGenerator-CRvsKIrl.d.ts} +8 -8
  2. package/dist/{generators-CcqanVXN.cjs → generators-DGutWnSj.cjs} +2 -2
  3. package/dist/generators-DGutWnSj.cjs.map +1 -0
  4. package/dist/{generators-ITGOkP4V.js → generators-rtdUsxQh.js} +3 -3
  5. package/dist/generators-rtdUsxQh.js.map +1 -0
  6. package/dist/generators.cjs +1 -1
  7. package/dist/generators.d.ts +1 -1
  8. package/dist/generators.js +1 -1
  9. package/dist/hooks.cjs +2 -3
  10. package/dist/hooks.cjs.map +1 -1
  11. package/dist/hooks.d.ts +1 -1
  12. package/dist/hooks.js +2 -3
  13. package/dist/hooks.js.map +1 -1
  14. package/dist/index.cjs +7 -3
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +8 -2
  17. package/dist/index.js +7 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/{requestBody-BWuWn6Xp.js → requestBody-DMoaqEak.js} +56 -48
  20. package/dist/requestBody-DMoaqEak.js.map +1 -0
  21. package/dist/{requestBody-CLLG-M_R.cjs → requestBody-h1zQvUgJ.cjs} +56 -48
  22. package/dist/requestBody-h1zQvUgJ.cjs.map +1 -0
  23. package/dist/utils.cjs +1 -1
  24. package/dist/utils.cjs.map +1 -1
  25. package/dist/utils.d.ts +2 -3
  26. package/dist/utils.js +1 -1
  27. package/dist/utils.js.map +1 -1
  28. package/package.json +6 -6
  29. package/src/OperationGenerator.ts +4 -0
  30. package/src/SchemaGenerator.ts +2 -0
  31. package/src/generators/createReactGenerator.ts +7 -7
  32. package/src/generators/jsonGenerator.ts +2 -2
  33. package/src/hooks/useOas.ts +2 -5
  34. package/src/utils/getParams.ts +1 -2
  35. package/src/utils.tsx +44 -33
  36. package/dist/generators-CcqanVXN.cjs.map +0 -1
  37. package/dist/generators-ITGOkP4V.js.map +0 -1
  38. package/dist/requestBody-BWuWn6Xp.js.map +0 -1
  39. package/dist/requestBody-CLLG-M_R.cjs.map +0 -1
@@ -3,8 +3,8 @@ const require_getFooter = require("./getFooter-gshcRE1-.cjs");
3
3
  const require_SchemaMapper = require("./SchemaMapper-CeavHZlp.cjs");
4
4
  let _kubb_oas = require("@kubb/oas");
5
5
  let remeda = require("remeda");
6
- let _kubb_react_fabric = require("@kubb/react-fabric");
7
- let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
6
+ let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
7
+ let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
8
8
  //#region ../../internals/utils/src/names.ts
9
9
  /**
10
10
  * Returns a unique name by appending an incrementing numeric suffix when the name has already been used.
@@ -80,76 +80,82 @@ function getSchemaFactory(oas) {
80
80
  * Renders a React component for a list of operations (V1 generators).
81
81
  */
82
82
  async function renderOperations(operations, options) {
83
- const { config, driver, plugin, Component, generator } = options;
83
+ const { config, driver, plugin, oas, mode, Component, generator } = options;
84
84
  if (!Component) return;
85
- const { driver: genDriver, oas, mode } = generator.context;
86
- const fabricChild = (0, _kubb_react_fabric.createReactFabric)();
87
- await fabricChild.render(/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Fabric, {
88
- meta: {
89
- driver: genDriver,
90
- plugin,
91
- mode,
92
- oas
93
- },
94
- children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(Component, {
85
+ const renderer = (0, _kubb_renderer_jsx.createRenderer)();
86
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.KubbContext, {
87
+ driver,
88
+ plugin,
89
+ mode
90
+ });
91
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.OasContext, oas);
92
+ try {
93
+ await renderer.render(/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(Component, {
95
94
  config,
96
95
  operations,
97
96
  generator,
98
97
  plugin
99
- })
100
- }));
101
- driver.fileManager.upsert(...fabricChild.files);
102
- fabricChild.unmount();
98
+ }));
99
+ } finally {
100
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.OasContext);
101
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.KubbContext);
102
+ }
103
+ driver.fileManager.upsert(...renderer.files);
104
+ renderer.unmount();
103
105
  }
104
106
  /**
105
107
  * Renders a React component for a single operation (V1 generators).
106
108
  */
107
109
  async function renderOperation(operation, options) {
108
- const { config, driver, plugin, Component, generator } = options;
110
+ const { config, driver, plugin, oas, mode, Component, generator } = options;
109
111
  if (!Component) return;
110
- const { driver: genDriver, oas, mode } = generator.context;
111
- const fabricChild = (0, _kubb_react_fabric.createReactFabric)();
112
- await fabricChild.render(/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Fabric, {
113
- meta: {
114
- driver: genDriver,
115
- plugin,
116
- mode,
117
- oas
118
- },
119
- children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(Component, {
112
+ const renderer = (0, _kubb_renderer_jsx.createRenderer)();
113
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.KubbContext, {
114
+ driver,
115
+ plugin,
116
+ mode
117
+ });
118
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.OasContext, oas);
119
+ try {
120
+ await renderer.render(/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(Component, {
120
121
  config,
121
122
  operation,
122
123
  plugin,
123
124
  generator
124
- })
125
- }));
126
- driver.fileManager.upsert(...fabricChild.files);
127
- fabricChild.unmount();
125
+ }));
126
+ } finally {
127
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.OasContext);
128
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.KubbContext);
129
+ }
130
+ driver.fileManager.upsert(...renderer.files);
131
+ renderer.unmount();
128
132
  }
129
133
  /**
130
134
  * Renders a React component for a single schema (V1 generators).
131
135
  */
132
136
  async function renderSchema(schema, options) {
133
- const { config, driver, plugin, Component, generator } = options;
137
+ const { config, driver, plugin, oas, mode, Component, generator } = options;
134
138
  if (!Component) return;
135
- const { driver: genDriver, oas, mode } = generator.context;
136
- const fabricChild = (0, _kubb_react_fabric.createReactFabric)();
137
- await fabricChild.render(/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Fabric, {
138
- meta: {
139
- driver: genDriver,
140
- plugin,
141
- mode,
142
- oas
143
- },
144
- children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(Component, {
139
+ const renderer = (0, _kubb_renderer_jsx.createRenderer)();
140
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.KubbContext, {
141
+ driver,
142
+ plugin,
143
+ mode
144
+ });
145
+ (0, _kubb_renderer_jsx.provide)(_kubb_renderer_jsx.OasContext, oas);
146
+ try {
147
+ await renderer.render(/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(Component, {
145
148
  config,
146
149
  schema,
147
150
  plugin,
148
151
  generator
149
- })
150
- }));
151
- driver.fileManager.upsert(...fabricChild.files);
152
- fabricChild.unmount();
152
+ }));
153
+ } finally {
154
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.OasContext);
155
+ (0, _kubb_renderer_jsx.unprovide)(_kubb_renderer_jsx.KubbContext);
156
+ }
157
+ driver.fileManager.upsert(...renderer.files);
158
+ renderer.unmount();
153
159
  }
154
160
  //#endregion
155
161
  //#region src/SchemaGenerator.ts
@@ -1097,6 +1103,8 @@ var SchemaGenerator = class SchemaGenerator {
1097
1103
  }, {
1098
1104
  config: this.context.driver.config,
1099
1105
  driver: this.context.driver,
1106
+ oas: this.context.oas,
1107
+ mode: this.context.mode,
1100
1108
  Component: v1Generator.Schema,
1101
1109
  generator: this,
1102
1110
  plugin: {
@@ -1202,4 +1210,4 @@ Object.defineProperty(exports, "withRequiredRequestBodySchema", {
1202
1210
  }
1203
1211
  });
1204
1212
 
1205
- //# sourceMappingURL=requestBody-CLLG-M_R.cjs.map
1213
+ //# sourceMappingURL=requestBody-h1zQvUgJ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestBody-h1zQvUgJ.cjs","names":["KubbContext","OasContext","#options","#context","#nameMappingInitialized","#schemaNameMapping","#getOptions","#parseCache","#parseSchemaObject","isDeepEqual","isKeyword","schemaKeywords","#getUnknownType","#ensureNameMapping","#getRefAlias","KUBB_INLINE_REF_PREFIX","#getParsedSchemaObject","#getEmptyType","#addDiscriminatorToSchema","#wouldCreateCircularReference","pascalCase","#parseProperties","#doBuild"],"sources":["../../../internals/utils/src/names.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../src/utils/getSchemaFactory.ts","../src/utils.tsx","../src/SchemaGenerator.ts","../src/utils/requestBody.ts"],"sourcesContent":["/**\n * Returns a unique name by appending an incrementing numeric suffix when the name has already been used.\n * Mutates `data` in-place as a usage counter so subsequent calls remain consistent.\n *\n * @example\n * const seen: Record<string, number> = {}\n * getUniqueName('Foo', seen) // 'Foo'\n * getUniqueName('Foo', seen) // 'Foo2'\n * getUniqueName('Foo', seen) // 'Foo3'\n */\nexport function getUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n originalName += used\n }\n data[originalName] = 1\n return originalName\n}\n","/**\n * Strips a single matching pair of `\"...\"`, `'...'`, or `` `...` `` from both ends of `text`.\n * Returns the string unchanged when no balanced quote pair is found.\n *\n * @example\n * trimQuotes('\"hello\"') // 'hello'\n * trimQuotes('hello') // 'hello'\n */\nexport function trimQuotes(text: string): string {\n if (text.length >= 2) {\n const first = text[0]\n const last = text[text.length - 1]\n if ((first === '\"' && last === '\"') || (first === \"'\" && last === \"'\") || (first === '`' && last === '`')) {\n return text.slice(1, -1)\n }\n }\n return text\n}\n\n/**\n * Escapes characters that are not allowed inside JS string literals.\n * Handles quotes, backslashes, and Unicode line terminators (U+2028 / U+2029).\n *\n * @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.4\n *\n * @example\n * ```ts\n * jsStringEscape('say \"hi\"\\nbye') // 'say \\\\\"hi\\\\\"\\\\nbye'\n * ```\n */\nexport function jsStringEscape(input: unknown): string {\n return `${input}`.replace(/[\"'\\\\\\n\\r\\u2028\\u2029]/g, (character) => {\n switch (character) {\n case '\"':\n case \"'\":\n case '\\\\':\n return `\\\\${character}`\n case '\\n':\n return '\\\\n'\n case '\\r':\n return '\\\\r'\n case '\\u2028':\n return '\\\\u2028'\n case '\\u2029':\n return '\\\\u2029'\n default:\n return ''\n }\n })\n}\n\n/**\n * Returns a masked version of a string, showing only the first and last few characters.\n * Useful for logging sensitive values (tokens, keys) without exposing the full value.\n *\n * @example\n * maskString('KUBB_STUDIO-abc123-xyz789') // 'KUBB_STUDIO-…789'\n */\nexport function maskString(value: string, start = 8, end = 4): string {\n if (value.length <= start + end) return value\n return `${value.slice(0, start)}…${value.slice(-end)}`\n}\n\n/**\n * Strips the file extension from a path or file name.\n * Only removes the last `.ext` segment when the dot is not part of a directory name.\n *\n * @example\n * trimExtName('petStore.ts') // 'petStore'\n * trimExtName('/src/models/pet.ts') // '/src/models/pet'\n * trimExtName('/project.v2/gen/pet.ts') // '/project.v2/gen/pet'\n * trimExtName('noExtension') // 'noExtension'\n */\nexport function trimExtName(text: string): string {\n const dotIndex = text.lastIndexOf('.')\n if (dotIndex > 0 && !text.includes('/', dotIndex)) {\n return text.slice(0, dotIndex)\n }\n return text\n}\n","import { trimQuotes } from './string.ts'\n\n/**\n * Serializes a primitive value to a JSON string literal, stripping any surrounding quote characters first.\n *\n * @example\n * stringify('hello') // '\"hello\"'\n * stringify('\"hello\"') // '\"hello\"'\n */\nexport function stringify(value: string | number | boolean | undefined): string {\n if (value === undefined || value === null) return '\"\"'\n return JSON.stringify(trimQuotes(value.toString()))\n}\n\n/**\n * Converts a plain object into a multiline key-value string suitable for embedding in generated code.\n * Nested objects are recursively stringified with indentation.\n *\n * @example\n * stringifyObject({ foo: 'bar', nested: { a: 1 } })\n * // 'foo: bar,\\nnested: {\\n a: 1\\n }'\n */\nexport function stringifyObject(value: Record<string, unknown>): string {\n const items = Object.entries(value)\n .map(([key, val]) => {\n if (val !== null && typeof val === 'object') {\n return `${key}: {\\n ${stringifyObject(val as Record<string, unknown>)}\\n }`\n }\n return `${key}: ${val}`\n })\n .filter(Boolean)\n return items.join(',\\n')\n}\n\n/**\n * Strips functions, symbols, and `undefined` values from plugin options for safe JSON transport.\n *\n * @example\n * ```ts\n * serializePluginOptions({ output: './src', onWrite: () => {} })\n * // { output: './src' } (function stripped)\n * ```\n */\nexport function serializePluginOptions<TOptions extends object>(options: TOptions): TOptions {\n if (options === null || options === undefined) return {} as TOptions\n if (typeof options !== 'object') return options\n if (Array.isArray(options)) return options.map(serializePluginOptions) as unknown as TOptions\n\n const serialized: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(options)) {\n if (typeof value === 'function' || typeof value === 'symbol' || value === undefined) continue\n serialized[key] = value !== null && typeof value === 'object' ? serializePluginOptions(value as object) : value\n }\n return serialized as TOptions\n}\n\n/**\n * Strips all `undefined` values from an object recursively by round-tripping through JSON.\n * Useful for clean inline snapshot assertions that only show fields with actual values.\n *\n * @example\n * toSnapshot({ kind: 'Schema', name: undefined, type: 'string' })\n * // { kind: 'Schema', type: 'string' }\n */\nexport function toSnapshot<T>(value: T): T {\n return JSON.parse(JSON.stringify(value))\n}\n\n/**\n * Converts a dot-notation path or string array into an optional-chaining accessor expression.\n *\n * @example\n * getNestedAccessor('pagination.next.id', 'lastPage')\n * // → \"lastPage?.['pagination']?.['next']?.['id']\"\n */\nexport function getNestedAccessor(param: string | string[], accessor: string): string | null {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return null\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","import type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\nimport { isOpenApiV3_1Document } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.0'\n }\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema: SchemaObject | null) => SchemaResult<TWithRef> {\n return (schema: SchemaObject | null) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n","import type { Config, Plugin, PluginDriver, PluginFactoryOptions } from '@kubb/core'\nimport type { Oas, Operation, SchemaObject } from '@kubb/oas'\nimport { createRenderer, KubbContext, OasContext, provide, unprovide } from '@kubb/renderer-jsx'\nimport type { ReactGenerator } from './generators/createReactGenerator.ts'\nimport type { OperationGenerator } from './OperationGenerator.ts'\nimport type { SchemaGenerator, SchemaGeneratorOptions } from './SchemaGenerator.ts'\nimport type { Schema } from './SchemaMapper.ts'\n\ntype BuildOperationsV1Options<TOptions extends PluginFactoryOptions> = {\n config: Config\n driver: PluginDriver\n plugin: Plugin<TOptions>\n oas: Oas\n mode: 'single' | 'split'\n Component: ReactGenerator<TOptions>['Operations']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\n/**\n * Renders a React component for a list of operations (V1 generators).\n */\nexport async function renderOperations<TOptions extends PluginFactoryOptions>(\n operations: Array<Operation>,\n options: BuildOperationsV1Options<TOptions>,\n): Promise<void> {\n const { config, driver, plugin, oas, mode, Component, generator } = options\n\n if (!Component) {\n return undefined\n }\n\n const renderer = createRenderer()\n\n provide(KubbContext, { driver, plugin, mode })\n provide(OasContext, oas)\n try {\n await renderer.render(<Component config={config} operations={operations} generator={generator} plugin={plugin} />)\n } finally {\n unprovide(OasContext)\n unprovide(KubbContext)\n }\n\n driver.fileManager.upsert(...renderer.files)\n renderer.unmount()\n}\n\ntype BuildOperationV1Options<TOptions extends PluginFactoryOptions> = {\n config: Config\n driver: PluginDriver\n plugin: Plugin<TOptions>\n oas: Oas\n mode: 'single' | 'split'\n Component: ReactGenerator<TOptions>['Operation']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\n/**\n * Renders a React component for a single operation (V1 generators).\n */\nexport async function renderOperation<TOptions extends PluginFactoryOptions>(operation: Operation, options: BuildOperationV1Options<TOptions>): Promise<void> {\n const { config, driver, plugin, oas, mode, Component, generator } = options\n\n if (!Component) {\n return undefined\n }\n\n const renderer = createRenderer()\n\n provide(KubbContext, { driver, plugin, mode })\n provide(OasContext, oas)\n try {\n await renderer.render(<Component config={config} operation={operation} plugin={plugin} generator={generator} />)\n } finally {\n unprovide(OasContext)\n unprovide(KubbContext)\n }\n\n driver.fileManager.upsert(...renderer.files)\n renderer.unmount()\n}\n\ntype BuildSchemaV1Options<TOptions extends PluginFactoryOptions> = {\n config: Config\n driver: PluginDriver\n plugin: Plugin<TOptions>\n oas: Oas\n mode: 'single' | 'split'\n Component: ReactGenerator<TOptions>['Schema']\n generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n}\n\n/**\n * Renders a React component for a single schema (V1 generators).\n */\nexport async function renderSchema<TOptions extends PluginFactoryOptions>(\n schema: { name: string; tree: Array<Schema>; value: SchemaObject },\n options: BuildSchemaV1Options<TOptions>,\n): Promise<void> {\n const { config, driver, plugin, oas, mode, Component, generator } = options\n\n if (!Component) {\n return undefined\n }\n\n const renderer = createRenderer()\n\n provide(KubbContext, { driver, plugin, mode })\n provide(OasContext, oas)\n try {\n await renderer.render(<Component config={config} schema={schema} plugin={plugin} generator={generator} />)\n } finally {\n unprovide(OasContext)\n unprovide(KubbContext)\n }\n\n driver.fileManager.upsert(...renderer.files)\n renderer.unmount()\n}\n","import type { AsyncEventEmitter } from '@internals/utils'\nimport { getUniqueName, pascalCase, stringify } from '@internals/utils'\nimport type { FileNode } from '@kubb/ast/types'\nimport type { FileMetaBase, KubbEvents, Plugin, PluginDriver, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'\nimport type { contentType, Oas, OasTypes, OpenAPIV3, SchemaObject } from '@kubb/oas'\nimport { isDiscriminator, isNullable, isReference, KUBB_INLINE_REF_PREFIX } from '@kubb/oas'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\nimport type { CoreGenerator } from './generators/createGenerator.ts'\nimport type { ReactGenerator } from './generators/createReactGenerator.ts'\nimport type { Generator } from './generators/types.ts'\nimport { isKeyword, type Schema, type SchemaKeywordMapper, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { renderSchema } from './utils.tsx'\n\nexport type GetSchemaGeneratorOptions<T extends SchemaGenerator<any, any, any>> = T extends SchemaGenerator<infer Options, any, any> ? Options : never\n\nexport type SchemaMethodResult<TFileMeta extends FileMetaBase> = Promise<FileNode<TFileMeta> | Array<FileNode<TFileMeta>> | null>\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n oas: Oas\n driver: PluginDriver\n events?: AsyncEventEmitter<KubbEvents>\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: 'single' | 'split'\n include?: Array<'schemas' | 'responses' | 'requestBodies'>\n override: Array<Override<TOptions>> | undefined\n contentType?: contentType\n output?: string\n}\n\nexport type SchemaGeneratorOptions = {\n dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'\n integerType?: 'number' | 'bigint'\n unknownType: 'any' | 'unknown' | 'void'\n emptySchemaType: 'any' | 'unknown' | 'void'\n enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'\n enumSuffix?: string\n /**\n * @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.\n * When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.\n * @internal\n */\n usedEnumNames?: Record<string, number>\n mapper?: Record<string, string>\n typed?: boolean\n transformers: {\n /**\n * Customize the names based on the type that is provided by the plugin.\n */\n name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string\n /**\n * Receive schema and name(propertyName) and return Schema array.\n * Return `undefined` to fall through to default schema generation.\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Array<Schema> | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schema: SchemaObject | null\n name: string | null\n parentName: string | null\n rootName?: string | null\n}\n\nexport class SchemaGenerator<\n TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions,\n TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions,\n TFileMeta extends FileMetaBase = FileMetaBase,\n> {\n #options: TOptions\n #context: Context<TOptions, TPluginOptions>\n\n constructor(options: TOptions, context: Context<TOptions, TPluginOptions>) {\n this.#options = options\n this.#context = context\n }\n\n get options(): TOptions {\n return this.#options\n }\n\n set options(options: TOptions) {\n this.#options = { ...this.#options, ...options }\n }\n\n get context(): Context<TOptions, TPluginOptions> {\n return this.#context\n }\n // Collect the types of all referenced schemas, so we can export them later\n refs: Refs = {}\n\n // Map from original component paths to resolved schema names (after collision resolution)\n // e.g., { '#/components/schemas/Order': 'OrderSchema', '#/components/responses/Product': 'ProductResponse' }\n #schemaNameMapping: Map<string, string> = new Map()\n\n // Flag to track if nameMapping has been initialized\n #nameMappingInitialized = false\n\n // Cache for parsed schemas to avoid redundant parsing\n // Using WeakMap for automatic garbage collection when schemas are no longer referenced\n #parseCache: Map<string, Schema[]> = new Map()\n\n /**\n * Ensure the name mapping is initialized (lazy initialization)\n */\n #ensureNameMapping() {\n if (this.#nameMappingInitialized) {\n return\n }\n\n const { oas, contentType, include } = this.context\n const { nameMapping } = oas.getSchemas({ contentType, includes: include })\n this.#schemaNameMapping = nameMapping\n this.#nameMappingInitialized = true\n }\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n parse(props: SchemaProps): Schema[] {\n const options = this.#getOptions(props.name)\n\n // Only cache when schema is a simple object (not null/undefined)\n // and doesn't have transformers that could affect the result\n let shouldCache = props.schema && typeof props.schema === 'object' && !options.transformers?.schema\n let cacheKey = ''\n\n if (shouldCache) {\n // Create cache key using stable JSON stringify for correctness\n // Cache hit rate is still high for identical schemas across operations\n try {\n cacheKey = JSON.stringify({\n schema: props.schema,\n name: props.name,\n parentName: props.parentName,\n rootName: props.rootName,\n })\n\n const cached = this.#parseCache.get(cacheKey)\n if (cached) {\n return cached\n }\n } catch {\n // If JSON.stringify fails (circular refs), skip caching\n shouldCache = false\n }\n }\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n const result = uniqueWith(schemas, isDeepEqual)\n\n // Cache the result only if we created a valid cache key\n if (shouldCache && cacheKey) {\n this.#parseCache.set(cacheKey, result)\n }\n\n return result\n }\n\n static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]> {\n const foundItems: SchemaKeywordMapper[T][] = []\n\n tree?.forEach((schema) => {\n if (schema.keyword === keyword) {\n foundItems.push(schema as SchemaKeywordMapper[T])\n }\n\n if (isKeyword(schema, schemaKeywords.object)) {\n Object.values(schema.args?.properties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>(entrySchema, keyword))\n })\n\n Object.values(schema.args?.additionalProperties || {}).forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n\n if (schema.args?.patternProperties) {\n Object.values(schema.args.patternProperties).forEach((entrySchemas) => {\n entrySchemas.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n })\n }\n }\n\n if (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.args.forEach((entrySchema) => {\n foundItems.push(...SchemaGenerator.deepSearch<T>([entrySchema], keyword))\n })\n }\n })\n\n return foundItems\n }\n\n static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined {\n let foundItem: SchemaKeywordMapper[T] | undefined\n\n tree?.forEach((schema) => {\n if (!foundItem && schema.keyword === keyword) {\n foundItem = schema as SchemaKeywordMapper[T]\n }\n\n if (isKeyword(schema, schemaKeywords.array)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.and)) {\n schema.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.tuple)) {\n schema.args.items.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n\n if (isKeyword(schema, schemaKeywords.union)) {\n schema.args.forEach((entrySchema) => {\n if (!foundItem) {\n foundItem = SchemaGenerator.find<T>([entrySchema], keyword)\n }\n })\n }\n })\n\n return foundItem\n }\n\n static combineObjects(tree: Schema[] | undefined): Schema[] {\n if (!tree) {\n return []\n }\n\n return tree.map((schema) => {\n if (!isKeyword(schema, schemaKeywords.and)) {\n return schema\n }\n\n let mergedProperties: Record<string, Schema[]> | null = null\n let mergedAdditionalProps: Schema[] = []\n\n const newArgs: Schema[] = []\n\n for (const subSchema of schema.args) {\n if (isKeyword(subSchema, schemaKeywords.object)) {\n const { properties = {}, additionalProperties = [] } = subSchema.args ?? {}\n\n if (!mergedProperties) {\n mergedProperties = {}\n }\n\n for (const [key, value] of Object.entries(properties)) {\n mergedProperties[key] = value\n }\n\n if (additionalProperties.length > 0) {\n mergedAdditionalProps = additionalProperties\n }\n } else {\n newArgs.push(subSchema)\n }\n }\n\n if (mergedProperties) {\n newArgs.push({\n keyword: schemaKeywords.object,\n args: {\n properties: mergedProperties,\n additionalProperties: mergedAdditionalProps,\n },\n })\n }\n\n return {\n keyword: schemaKeywords.and,\n args: newArgs,\n }\n })\n }\n\n #getOptions(name: string | null): Partial<TOptions> {\n const { override = [] } = this.context\n\n return {\n ...this.options,\n ...(override.find(({ pattern, type }) => {\n if (name && type === 'schemaName') {\n return !!name.match(pattern)\n }\n\n return false\n })?.options || {}),\n }\n }\n\n #getUnknownType(name: string | null): string {\n const options = this.#getOptions(name)\n\n if (options.unknownType === 'any') {\n return schemaKeywords.any\n }\n if (options.unknownType === 'void') {\n return schemaKeywords.void\n }\n\n return schemaKeywords.unknown\n }\n\n #getEmptyType(name: string | null): string {\n const options = this.#getOptions(name)\n\n if (options.emptySchemaType === 'any') {\n return schemaKeywords.any\n }\n if (options.emptySchemaType === 'void') {\n return schemaKeywords.void\n }\n\n return schemaKeywords.unknown\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #parseProperties(name: string | null, schemaObject: SchemaObject, rootName?: string | null): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\n const patternProperties = schemaObject && 'patternProperties' in schemaObject ? schemaObject.patternProperties : undefined\n\n const propertiesSchemas = Object.keys(properties)\n .map((propertyName) => {\n const validationFunctions: Schema[] = []\n const propertySchema = properties[propertyName] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required?.includes(propertyName) : !!required\n const nullable = isNullable(propertySchema)\n\n validationFunctions.push(...this.parse({ schema: propertySchema, name: propertyName, parentName: name, rootName: rootName || name }))\n\n validationFunctions.push({\n keyword: schemaKeywords.name,\n args: propertyName,\n })\n\n if (!isRequired && nullable) {\n validationFunctions.push({ keyword: schemaKeywords.nullish })\n } else if (!isRequired) {\n validationFunctions.push({ keyword: schemaKeywords.optional })\n }\n\n return {\n [propertyName]: validationFunctions,\n }\n })\n .reduce((acc, curr) => ({ ...acc, ...curr }), {})\n let additionalPropertiesSchemas: Schema[] = []\n\n if (additionalProperties) {\n additionalPropertiesSchemas =\n additionalProperties === true || !Object.keys(additionalProperties).length\n ? [{ keyword: this.#getUnknownType(name) }]\n : this.parse({ schema: additionalProperties as SchemaObject, name: null, parentName: name, rootName: rootName || name })\n }\n\n let patternPropertiesSchemas: Record<string, Schema[]> = {}\n\n if (patternProperties && typeof patternProperties === 'object') {\n patternPropertiesSchemas = Object.entries(patternProperties).reduce((acc, [pattern, patternSchema]) => {\n const schemas =\n patternSchema === true || !Object.keys(patternSchema as object).length\n ? [{ keyword: this.#getUnknownType(name) }]\n : this.parse({ schema: patternSchema, name: null, parentName: name, rootName: rootName || name })\n\n return {\n ...acc,\n [pattern]: schemas,\n }\n }, {})\n }\n\n const args: {\n properties: typeof propertiesSchemas\n additionalProperties: typeof additionalPropertiesSchemas\n patternProperties?: typeof patternPropertiesSchemas\n } = {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n }\n\n if (Object.keys(patternPropertiesSchemas).length > 0) {\n args['patternProperties'] = patternPropertiesSchemas\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args,\n },\n ]\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(schemaObject: OpenAPIV3.ReferenceObject, name: string | null): Schema[] {\n const { $ref } = schemaObject\n const ref = this.refs[$ref]\n\n if (ref) {\n const dereferencedSchema = this.context.oas.dereferenceWithRef(schemaObject)\n // pass name to getRefAlias and use that to find in discriminator.mapping value\n\n if (dereferencedSchema && isDiscriminator(dereferencedSchema)) {\n const [key] = Object.entries(dereferencedSchema.discriminator.mapping || {}).find(([_key, value]) => value.replace(/.+\\//, '') === name) || []\n\n if (key) {\n return [\n {\n keyword: schemaKeywords.and,\n args: [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, $ref, path: ref.path, isImportable: !!this.context.oas.get($ref) },\n },\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n [dereferencedSchema.discriminator.propertyName]: [\n {\n keyword: schemaKeywords.const,\n args: {\n name: key,\n format: 'string',\n value: key,\n },\n },\n ],\n },\n },\n },\n ],\n },\n ] as Schema[]\n }\n }\n\n return [\n {\n keyword: schemaKeywords.ref,\n args: { name: ref.propertyName, $ref, path: ref.path, isImportable: !!this.context.oas.get($ref) },\n },\n ]\n }\n\n // Handle non-component internal refs (e.g., #/paths/... created by the bundler when deduplicating\n // external schemas referenced multiple times). These path-based refs produce misleading names\n // from their last path segment (e.g., \"#/.../schema/items\" → \"items\" → \"itemsSchema\").\n // Resolve them inline instead of registering them as named schema references.\n if ($ref.startsWith('#') && !$ref.startsWith('#/components/')) {\n try {\n const inlineSchema = this.context.oas.get<SchemaObject>($ref)\n if (inlineSchema && !isReference(inlineSchema)) {\n return this.parse({ schema: inlineSchema, name, parentName: null, rootName: null })\n }\n } catch {\n // If lookup fails, fall through to standard processing\n }\n }\n\n // Ensure name mapping is initialized before resolving names\n this.#ensureNameMapping()\n\n const originalName = $ref.replace(/.+\\//, '')\n // Use the full $ref path to look up the collision-resolved name\n const resolvedName = this.#schemaNameMapping.get($ref) || originalName\n\n const propertyName = this.context.driver.resolveName({\n name: resolvedName,\n pluginName: this.context.plugin.name,\n type: 'function',\n })\n\n const fileName = this.context.driver.resolveName({\n name: resolvedName,\n pluginName: this.context.plugin.name,\n type: 'file',\n })\n const file = this.context.driver.getFile({\n name: fileName,\n pluginName: this.context.plugin.name,\n extname: '.ts',\n })\n\n this.refs[$ref] = {\n propertyName,\n originalName: resolvedName,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema: SchemaObject | null) {\n return getSchemaFactory(this.context.oas)(schema)\n }\n\n #addDiscriminatorToSchema<TSchema extends Schema>({\n schema,\n schemaObject,\n discriminator,\n }: {\n schemaObject: SchemaObject\n schema: TSchema\n discriminator: OpenAPIV3.DiscriminatorObject\n }): TSchema {\n if (!isKeyword(schema, schemaKeywords.union)) {\n return schema\n }\n\n // If the discriminator property is an extension property (starts with x-),\n // its metadata and not an actual schema property, so we can't add constraints for it.\n // In this case, return the union as-is without adding discriminator constraints.\n if (discriminator.propertyName.startsWith('x-')) {\n return schema\n }\n\n const objectPropertySchema = SchemaGenerator.find(this.parse({ schema: schemaObject, name: null, parentName: null, rootName: null }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {})\n .map(([key, value]) => {\n let arg: Schema | undefined\n\n // Check if this is a synthetic ref for inline schemas (e.g., #kubb-inline-0)\n if (value.startsWith(KUBB_INLINE_REF_PREFIX)) {\n const index = Number.parseInt(value.replace(KUBB_INLINE_REF_PREFIX, ''), 10)\n // Validate index is within bounds\n if (!Number.isNaN(index) && index >= 0 && index < schema.args.length) {\n arg = schema.args[index]\n }\n } else {\n // Regular ref - find by $ref value\n arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\n }\n\n // Skip discriminator mappings that don't have a corresponding schema in the oneOf/anyOf\n if (!arg) {\n return undefined\n }\n return {\n keyword: schemaKeywords.and,\n args: [\n arg,\n {\n keyword: schemaKeywords.object,\n args: {\n properties: {\n ...(objectPropertySchema?.args?.properties || {}),\n [discriminator.propertyName]: [\n {\n keyword: schemaKeywords.const,\n args: {\n name: key,\n format: 'string',\n value: key,\n },\n },\n //enum and literal will conflict\n ...(objectPropertySchema?.args?.properties[discriminator.propertyName] || []),\n ].filter((item) => !isKeyword(item, schemaKeywords.enum)),\n },\n },\n },\n ],\n }\n })\n .filter(Boolean) as SchemaKeywordMapper['union']['args'],\n }\n }\n\n /**\n * Checks if an allOf item reference would create a circular reference.\n * This happens when a child schema extends a discriminator parent via allOf,\n * and the parent has a oneOf/anyOf that references or maps to the child.\n *\n * Without oneOf/anyOf, the discriminator is just for documentation/validation\n * purposes and doesn't create a TypeScript union type that would be circular.\n */\n #wouldCreateCircularReference(item: unknown, childSchemaName: string | null): boolean {\n if (!isReference(item) || !childSchemaName) {\n return false\n }\n\n const dereferencedSchema = this.context.oas.dereferenceWithRef(item)\n\n if (dereferencedSchema && isDiscriminator(dereferencedSchema)) {\n // Only check for circular references if parent has oneOf/anyOf\n // Without oneOf/anyOf, the discriminator doesn't create a union type\n const parentOneOf = dereferencedSchema.oneOf || dereferencedSchema.anyOf\n if (!parentOneOf) {\n return false\n }\n\n const childRef = `#/components/schemas/${childSchemaName}`\n\n const inOneOf = parentOneOf.some((oneOfItem) => {\n return isReference(oneOfItem) && oneOfItem.$ref === childRef\n })\n if (inOneOf) {\n return true\n }\n\n const mapping = dereferencedSchema.discriminator.mapping || {}\n const inMapping = Object.values(mapping).some((value) => value === childRef)\n\n if (inMapping) {\n return true\n }\n }\n return false\n }\n\n /**\n * This is the very core of the OpenAPI to TS conversion - it takes a\n * schema and returns the appropriate type.\n */\n #parseSchemaObject({ schema: _schemaObject, name, parentName, rootName }: SchemaProps): Schema[] {\n const normalizedSchema = this.context.oas.flattenSchema(_schemaObject)\n\n const { schemaObject, version } = this.#getParsedSchemaObject(normalizedSchema)\n\n const options = this.#getOptions(name)\n const emptyType = this.#getEmptyType(name)\n\n if (!schemaObject) {\n return [{ keyword: emptyType }]\n }\n\n const baseItems: Schema[] = [\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schemaObject.type as SchemaKeywordMapper['schema']['args']['type'],\n format: schemaObject.format,\n },\n },\n ]\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n\n const exclusiveMinimum = schemaObject.exclusiveMinimum\n const exclusiveMaximum = schemaObject.exclusiveMaximum\n\n const nullable = isNullable(schemaObject)\n const defaultNullAndNullable = schemaObject.default === null && nullable\n\n if (schemaObject.default !== undefined && !defaultNullAndNullable && !Array.isArray(schemaObject.default)) {\n if (typeof schemaObject.default === 'string') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: stringify(schemaObject.default),\n })\n } else if (typeof schemaObject.default === 'boolean') {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schemaObject.default ?? false,\n })\n } else {\n baseItems.push({\n keyword: schemaKeywords.default,\n args: schemaObject.default,\n })\n }\n }\n\n if (schemaObject.deprecated) {\n baseItems.push({\n keyword: schemaKeywords.deprecated,\n })\n }\n\n if (schemaObject.description) {\n baseItems.push({\n keyword: schemaKeywords.describe,\n args: schemaObject.description,\n })\n }\n\n if (max !== undefined) {\n if (exclusiveMaximum) {\n baseItems.unshift({ keyword: schemaKeywords.exclusiveMaximum, args: max })\n } else {\n baseItems.unshift({ keyword: schemaKeywords.max, args: max })\n }\n }\n\n if (min !== undefined) {\n if (exclusiveMinimum) {\n baseItems.unshift({ keyword: schemaKeywords.exclusiveMinimum, args: min })\n } else {\n baseItems.unshift({ keyword: schemaKeywords.min, args: min })\n }\n }\n\n if (typeof exclusiveMaximum === 'number') {\n //OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n baseItems.unshift({ keyword: schemaKeywords.exclusiveMaximum, args: exclusiveMaximum })\n }\n if (typeof exclusiveMinimum === 'number') {\n //OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n baseItems.unshift({ keyword: schemaKeywords.exclusiveMinimum, args: exclusiveMinimum })\n }\n if (nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n\n if (schemaObject.type && Array.isArray(schemaObject.type)) {\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const items = schemaObject.type.filter((value) => value !== 'null') as Array<OpenAPIV3.NonArraySchemaObjectType>\n\n if (items.length > 1) {\n const parsedItems = [\n {\n keyword: schemaKeywords.union,\n args: items\n .map(\n (item) =>\n this.parse({\n schema: { ...schemaObject, type: item },\n name,\n parentName,\n rootName,\n })[0],\n )\n .filter((x): x is Schema => Boolean(x))\n .map((item) => (isKeyword(item, schemaKeywords.object) ? { ...item, args: { ...item.args, strict: true } } : item)),\n },\n ]\n\n return [...parsedItems, ...baseItems].filter(Boolean)\n }\n }\n\n if (schemaObject.readOnly) {\n baseItems.push({ keyword: schemaKeywords.readOnly })\n }\n\n if (schemaObject.writeOnly) {\n baseItems.push({ keyword: schemaKeywords.writeOnly })\n }\n\n if (isReference(schemaObject)) {\n return [\n ...this.#getRefAlias(schemaObject, name),\n ...baseItems.filter((item) => item.keyword === schemaKeywords.default),\n schemaObject.description && {\n keyword: schemaKeywords.describe,\n args: schemaObject.description,\n },\n schemaObject.pattern &&\n schemaObject.type === 'string' && {\n keyword: schemaKeywords.matches,\n args: schemaObject.pattern,\n },\n nullable && { keyword: schemaKeywords.nullable },\n schemaObject.readOnly && { keyword: schemaKeywords.readOnly },\n schemaObject.writeOnly && { keyword: schemaKeywords.writeOnly },\n {\n keyword: schemaKeywords.schema,\n args: {\n type: schemaObject.type as SchemaKeywordMapper['schema']['args']['type'],\n format: schemaObject.format,\n },\n },\n ].filter((x): x is Schema => Boolean(x))\n }\n\n if (schemaObject.oneOf || schemaObject.anyOf) {\n // union\n const schemaWithoutOneOf = { ...schemaObject, oneOf: undefined, anyOf: undefined }\n const discriminator = this.context.oas.getDiscriminator(schemaObject)\n\n const union: SchemaKeywordMapper['union'] = {\n keyword: schemaKeywords.union,\n args: (schemaObject.oneOf || schemaObject.anyOf)!\n .map((item) => {\n // first item, this is ref\n return item && this.parse({ schema: item as SchemaObject, name, parentName, rootName })[0]\n })\n .filter((x): x is Schema => Boolean(x)),\n }\n\n if (discriminator) {\n // In 'inherit' mode, the discriminator property is already added to child schemas by Oas.getDiscriminator()\n // so we should NOT add it at the union level\n if (this.context && this.context.oas.options.discriminator !== 'inherit') {\n return [this.#addDiscriminatorToSchema({ schemaObject: schemaWithoutOneOf, schema: union, discriminator }), ...baseItems]\n }\n }\n\n if (schemaWithoutOneOf.properties) {\n const propertySchemas = this.parse({ schema: schemaWithoutOneOf, name, parentName, rootName })\n\n union.args = [\n ...union.args.map((arg) => {\n return {\n keyword: schemaKeywords.and,\n args: [arg, ...propertySchemas],\n }\n }),\n ]\n\n return [union, ...baseItems]\n }\n\n return [union, ...baseItems]\n }\n\n if (schemaObject.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schemaObject, allOf: undefined }\n\n const and: Schema = {\n keyword: schemaKeywords.and,\n args: schemaObject.allOf\n .flatMap((item) => {\n // Skip items that would create circular references\n if (this.#wouldCreateCircularReference(item, name)) {\n return []\n }\n\n return item ? this.parse({ schema: item, name, parentName, rootName }) : []\n })\n .filter(Boolean),\n }\n\n if (schemaWithoutAllOf.required?.length) {\n const allOfItems = schemaObject.allOf\n const resolvedSchemas: SchemaObject[] = []\n\n for (const item of allOfItems) {\n const resolved = isReference(item) ? (this.context.oas.get(item.$ref) as SchemaObject) : item\n\n if (resolved) {\n resolvedSchemas.push(resolved)\n }\n }\n\n const existingKeys = schemaWithoutAllOf.properties ? new Set(Object.keys(schemaWithoutAllOf.properties)) : null\n\n const parsedItems: SchemaObject[] = []\n\n for (const key of schemaWithoutAllOf.required) {\n if (existingKeys?.has(key)) {\n continue\n }\n\n for (const schema of resolvedSchemas) {\n if (schema.properties?.[key]) {\n parsedItems.push({\n properties: {\n [key]: schema.properties[key],\n },\n required: [key],\n } as SchemaObject)\n break\n }\n }\n }\n\n for (const item of parsedItems) {\n const parsed = this.parse({ schema: item, name, parentName, rootName })\n\n if (Array.isArray(parsed)) {\n and.args = and.args ? and.args.concat(parsed) : parsed\n }\n }\n }\n\n if (schemaWithoutAllOf.properties) {\n and.args = [...(and.args || []), ...this.parse({ schema: schemaWithoutAllOf, name, parentName, rootName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n // Handle malformed schema where enum exists at array level instead of in items\n // This normalizes: { type: 'array', enum: [...], items: {...} }\n // Into: { type: 'array', items: { type: 'string', enum: [...] } }\n if (schemaObject.type === 'array') {\n const isItemsObject = typeof schemaObject.items === 'object' && !Array.isArray(schemaObject.items)\n const normalizedItems = {\n ...(isItemsObject ? schemaObject.items : {}),\n enum: schemaObject.enum,\n } as SchemaObject\n\n const { enum: _, ...schemaWithoutEnum } = schemaObject\n const normalizedSchema = {\n ...schemaWithoutEnum,\n items: normalizedItems,\n } as SchemaObject\n\n return this.parse({ schema: normalizedSchema, name, parentName, rootName })\n }\n\n // Removed verbose enum parsing debug log - too noisy for hundreds of enums\n\n // Include rootName in enum naming to avoid collisions for nested enums with same path\n // Only add rootName if it differs from parentName to avoid duplication\n // This is controlled by the collisionDetection flag to maintain backward compatibility\n const useCollisionDetection = this.context.oas.options.collisionDetection ?? false\n const enumNameParts =\n useCollisionDetection && rootName && rootName !== parentName ? [rootName, parentName, name, options.enumSuffix] : [parentName, name, options.enumSuffix]\n\n // @deprecated usedEnumNames will be removed in v5 - collisionDetection with rootName-based naming eliminates the need for numeric suffixes\n const enumName = useCollisionDetection\n ? pascalCase(enumNameParts.join(' '))\n : getUniqueName(pascalCase(enumNameParts.join(' ')), this.options.usedEnumNames || {})\n const typeName = this.context.driver.resolveName({\n name: enumName,\n pluginName: this.context.plugin.name,\n type: 'type',\n })\n\n const nullableEnum = schemaObject.enum.includes(null)\n if (nullableEnum) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\n const filteredValues = schemaObject.enum.filter((value) => value !== null)\n\n // x-enumNames has priority\n const extensionEnums = ['x-enumNames', 'x-enum-varnames']\n .filter((extensionKey) => extensionKey in schemaObject)\n .map((extensionKey) => {\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name,\n typeName,\n asConst: false,\n items: [...new Set(schemaObject[extensionKey as keyof typeof schemaObject] as string[])].map((name: string | number, index) => ({\n name: stringify(name),\n value: schemaObject.enum?.[index] as string | number,\n format: isNumber(schemaObject.enum?.[index]) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter(\n (item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches,\n ),\n ]\n })\n\n if (schemaObject.type === 'number' || schemaObject.type === 'integer') {\n // we cannot use z.enum when enum type is number/integer\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'number',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'number',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (schemaObject.type === 'boolean') {\n // we cannot use z.enum when enum type is boolean\n const enumNames = extensionEnums[0]?.find((item) => isKeyword(item, schemaKeywords.enum)) as unknown as SchemaKeywordMapper['enum']\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: true,\n items: enumNames?.args?.items\n ? [...new Set(enumNames.args.items)].map(({ name, value }) => ({\n name,\n value,\n format: 'boolean',\n }))\n : [...new Set(filteredValues)].map((value: string) => {\n return {\n name: value,\n value,\n format: 'boolean',\n }\n }),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n return extensionEnums[0]\n }\n\n return [\n {\n keyword: schemaKeywords.enum,\n args: {\n name: enumName,\n typeName,\n asConst: false,\n items: [...new Set(filteredValues)].map((value: string) => ({\n name: stringify(value),\n value,\n format: isNumber(value) ? 'number' : 'string',\n })),\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max && item.keyword !== schemaKeywords.matches),\n ]\n }\n\n if ('prefixItems' in schemaObject) {\n const prefixItems = schemaObject.prefixItems as SchemaObject[]\n const items = 'items' in schemaObject ? (schemaObject.items as SchemaObject[]) : []\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n\n return [\n {\n keyword: schemaKeywords.tuple,\n args: {\n min,\n max,\n items: prefixItems\n .map((item) => {\n return this.parse({ schema: item, name, parentName, rootName })[0]\n })\n .filter((x): x is Schema => Boolean(x)),\n rest: this.parse({\n schema: items,\n name,\n parentName,\n rootName,\n })[0],\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (version === '3.1' && 'const' in schemaObject) {\n // const keyword takes precedence over the actual type.\n\n if (schemaObject['const'] === null) {\n return [{ keyword: schemaKeywords.null }]\n }\n if (schemaObject['const'] === undefined) {\n return [{ keyword: schemaKeywords.undefined }]\n }\n\n let format = typeof schemaObject['const']\n if (format !== 'number' && format !== 'boolean') {\n format = 'string'\n }\n\n return [\n {\n keyword: schemaKeywords.const,\n args: {\n name: schemaObject['const'],\n format,\n value: schemaObject['const'],\n },\n },\n ...baseItems,\n ]\n }\n\n /**\n * > Structural validation alone may be insufficient to allow an application to correctly utilize certain values. The \"format\"\n * > annotation keyword is defined to allow schema authors to convey semantic information for a fixed subset of values which are\n * > accurately described by authoritative resources, be they RFCs or other external specifications.\n *\n * In other words: format is more specific than type alone, hence it should override the type value, if possible.\n *\n * see also https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.7\n */\n // Handle OpenAPI 3.1 contentMediaType for binary data\n if (schemaObject.type === 'string' && (schemaObject as SchemaObject & { contentMediaType?: string }).contentMediaType === 'application/octet-stream') {\n baseItems.unshift({ keyword: schemaKeywords.blob })\n return baseItems\n }\n\n if (schemaObject.format) {\n if (schemaObject.type === 'integer' && schemaObject.format === 'int64') {\n baseItems.unshift({ keyword: options.integerType === 'bigint' ? schemaKeywords.bigint : schemaKeywords.integer })\n return baseItems\n }\n\n if (schemaObject.type === 'integer' && schemaObject.format === 'int32') {\n baseItems.unshift({ keyword: schemaKeywords.integer })\n return baseItems\n }\n\n if (schemaObject.type === 'number' && (schemaObject.format === 'float' || schemaObject.format === 'double')) {\n baseItems.unshift({ keyword: schemaKeywords.number })\n return baseItems\n }\n\n switch (schemaObject.format) {\n case 'binary':\n baseItems.unshift({ keyword: schemaKeywords.blob })\n return baseItems\n case 'date-time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n if (options.dateType === 'stringOffset') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: true } })\n return baseItems\n }\n\n if (options.dateType === 'stringLocal') {\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { local: true } })\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.datetime, args: { offset: false } })\n\n return baseItems\n }\n break\n case 'date':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.date, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'time':\n if (options.dateType) {\n if (options.dateType === 'date') {\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'date' } })\n\n return baseItems\n }\n\n baseItems.unshift({ keyword: schemaKeywords.time, args: { type: 'string' } })\n\n return baseItems\n }\n break\n case 'uuid':\n baseItems.unshift({ keyword: schemaKeywords.uuid })\n return baseItems\n case 'email':\n case 'idn-email':\n baseItems.unshift({ keyword: schemaKeywords.email })\n return baseItems\n case 'uri':\n case 'ipv4':\n case 'ipv6':\n case 'uri-reference':\n case 'hostname':\n case 'idn-hostname':\n baseItems.unshift({ keyword: schemaKeywords.url })\n return baseItems\n // case 'duration':\n // case 'json-pointer':\n // case 'relative-json-pointer':\n default:\n // formats not yet implemented: ignore.\n break\n }\n }\n\n if (schemaObject.pattern && schemaObject.type === 'string') {\n baseItems.unshift({\n keyword: schemaKeywords.matches,\n args: schemaObject.pattern,\n })\n\n return baseItems\n }\n\n // type based logic\n if ('items' in schemaObject || schemaObject.type === ('array' as 'string')) {\n const min = schemaObject.minimum ?? schemaObject.minLength ?? schemaObject.minItems ?? undefined\n const max = schemaObject.maximum ?? schemaObject.maxLength ?? schemaObject.maxItems ?? undefined\n const items = this.parse({ schema: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName, rootName })\n const unique = !!schemaObject.uniqueItems\n\n return [\n {\n keyword: schemaKeywords.array,\n args: {\n items,\n min,\n max,\n unique,\n },\n },\n ...baseItems.filter((item) => item.keyword !== schemaKeywords.min && item.keyword !== schemaKeywords.max),\n ]\n }\n\n if (schemaObject.properties || schemaObject.additionalProperties || 'patternProperties' in schemaObject) {\n if (isDiscriminator(schemaObject)) {\n // override schema to set type to be based on discriminator mapping, use of enum to convert type string to type 'mapping1' | 'mapping2'\n const schemaObjectOverridden = Object.keys(schemaObject.properties || {}).reduce<SchemaObject>((acc, propertyName) => {\n if (acc.properties?.[propertyName] && propertyName === schemaObject.discriminator.propertyName) {\n const existingProperty = acc.properties[propertyName] as SchemaObject\n return {\n ...acc,\n properties: {\n ...acc.properties,\n [propertyName]: {\n ...existingProperty,\n enum: schemaObject.discriminator.mapping ? Object.keys(schemaObject.discriminator.mapping) : undefined,\n },\n },\n } as SchemaObject\n }\n\n return acc\n }, schemaObject as SchemaObject)\n\n return [...this.#parseProperties(name, schemaObjectOverridden, rootName), ...baseItems]\n }\n\n return [...this.#parseProperties(name, schemaObject, rootName), ...baseItems]\n }\n\n if (schemaObject.type) {\n const type = (\n Array.isArray(schemaObject.type) ? schemaObject.type.filter((item) => item !== 'null')[0] : schemaObject.type\n ) as OpenAPIV3.NonArraySchemaObjectType\n\n if (!['boolean', 'object', 'number', 'string', 'integer', 'null'].includes(type)) {\n this.context.events?.emit('warn', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n // Removed duplicate debug log - warning already provides the information needed\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n // Infer type from constraints when no explicit type is provided\n let inferredType: OpenAPIV3.NonArraySchemaObjectType | undefined\n if (schemaObject.minLength !== undefined || schemaObject.maxLength !== undefined || schemaObject.pattern !== undefined) {\n inferredType = 'string'\n } else if (schemaObject.minimum !== undefined || schemaObject.maximum !== undefined) {\n inferredType = 'number'\n }\n // Note: minItems/maxItems don't infer type 'array' because arrays are handled\n // specially with schemaKeywords.array and require an items property\n\n if (inferredType) {\n return [{ keyword: inferredType }, ...baseItems]\n }\n\n return [{ keyword: emptyType }, ...baseItems]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<FileNode<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n\n // Initialize the name mapping if not already done\n if (!this.#nameMappingInitialized) {\n const { schemas, nameMapping } = oas.getSchemas({ contentType, includes: include })\n this.#schemaNameMapping = nameMapping\n this.#nameMappingInitialized = true\n const schemaEntries = Object.entries(schemas)\n\n this.context.events?.emit('debug', {\n date: new Date(),\n logs: [`Building ${schemaEntries.length} schemas`, ` • Content Type: ${contentType || 'application/json'}`, ` • Generators: ${generators.length}`],\n })\n\n // Continue with build using the schemas\n return this.#doBuild(schemas, generators)\n }\n // If already initialized, just get the schemas (without mapping)\n const { schemas } = oas.getSchemas({ contentType, includes: include })\n return this.#doBuild(schemas, generators)\n }\n\n async #doBuild(schemas: Record<string, OasTypes.SchemaObject>, generators: Array<Generator<TPluginOptions>>): Promise<Array<FileNode<TFileMeta>>> {\n const schemaEntries = Object.entries(schemas)\n\n const results: Array<FileNode<TFileMeta>> = []\n\n for (const generator of generators) {\n if (!('type' in generator)) {\n continue\n }\n\n // After the v2 guard above, all generators here are v1\n const v1Generator = generator as ReactGenerator<TPluginOptions> | CoreGenerator<TPluginOptions>\n\n for (const [name, schemaObject] of schemaEntries) {\n const options = this.#getOptions(name)\n\n const tree = this.parse({ schema: schemaObject as SchemaObject, name, parentName: null, rootName: name })\n\n if (v1Generator.type === 'react') {\n await renderSchema(\n {\n name,\n value: schemaObject as SchemaObject,\n tree,\n },\n {\n config: this.context.driver.config,\n driver: this.context.driver,\n oas: this.context.oas,\n mode: this.context.mode,\n Component: v1Generator.Schema,\n generator: this,\n plugin: {\n ...this.context.plugin,\n options: {\n ...this.options,\n ...options,\n } as unknown as Plugin<TPluginOptions>['options'],\n },\n },\n )\n } else {\n const result = await v1Generator.schema?.({\n config: this.context.driver.config,\n generator: this,\n schema: {\n name,\n value: schemaObject as SchemaObject,\n tree,\n },\n plugin: {\n ...this.context.plugin,\n options: {\n ...this.options,\n ...options,\n } as unknown as Plugin<TPluginOptions>['options'],\n },\n })\n\n results.push(...([result ?? []].flat() as Array<FileNode<TFileMeta>>))\n }\n }\n }\n\n return results\n }\n}\n","import type { OasTypes } from '@kubb/oas'\nimport type { OperationSchema } from '../types.ts'\n\n/**\n * Sentinel value injected into `schema.required` to signal that the request body is required.\n * Downstream generators check for this marker to emit the correct required constraint.\n */\nexport const KUBB_REQUIRED_REQUEST_BODY_MARKER = '__kubb_required_request_body__'\n\nfunction getRequestBody(operationSchema: OperationSchema | undefined): OasTypes.RequestBodyObject | undefined {\n const requestBody = operationSchema?.operation?.schema?.requestBody\n\n if (!requestBody || '$ref' in requestBody) {\n return undefined\n }\n\n return requestBody\n}\n\nexport function isRequestBodyRequired(operationSchema: OperationSchema | undefined): boolean {\n const requestBody = getRequestBody(operationSchema)\n\n return !!requestBody && requestBody.required === true\n}\n\nexport function withRequiredRequestBodySchema(operationSchema: OperationSchema | undefined): OperationSchema | undefined {\n if (!operationSchema || !isRequestBodyRequired(operationSchema)) {\n return operationSchema\n }\n\n if (Array.isArray(operationSchema.schema.required) && operationSchema.schema.required.length > 0) {\n return operationSchema\n }\n\n return {\n ...operationSchema,\n schema: {\n ...operationSchema.schema,\n required: [KUBB_REQUIRED_REQUEST_BODY_MARKER],\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,SAAgB,cAAc,cAAsB,MAAsC;CACxF,IAAI,OAAO,KAAK,iBAAiB;AACjC,KAAI,MAAM;AACR,OAAK,gBAAgB,EAAE;AACvB,kBAAgB;;AAElB,MAAK,gBAAgB;AACrB,QAAO;;;;;;;;;;;;ACTT,SAAgB,WAAW,MAAsB;AAC/C,KAAI,KAAK,UAAU,GAAG;EACpB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK,KAAK,SAAS;AAChC,MAAK,UAAU,QAAO,SAAS,QAAS,UAAU,OAAO,SAAS,OAAS,UAAU,OAAO,SAAS,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AAK;QACR,GAAG;QACJ;OACF;MACF,CAAC;AAEF,aAAQ,KAAK,GAAI,CAAC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAgC;;;;AAK5E,SAAO;;;;;;;;;ACp4CX,MAAa,oCAAoC;AAEjD,SAAS,eAAe,iBAAsF;CAC5G,MAAM,cAAc,iBAAiB,WAAW,QAAQ;AAExD,KAAI,CAAC,eAAe,UAAU,YAC5B;AAGF,QAAO;;AAGT,SAAgB,sBAAsB,iBAAuD;CAC3F,MAAM,cAAc,eAAe,gBAAgB;AAEnD,QAAO,CAAC,CAAC,eAAe,YAAY,aAAa;;AAGnD,SAAgB,8BAA8B,iBAA2E;AACvH,KAAI,CAAC,mBAAmB,CAAC,sBAAsB,gBAAgB,CAC7D,QAAO;AAGT,KAAI,MAAM,QAAQ,gBAAgB,OAAO,SAAS,IAAI,gBAAgB,OAAO,SAAS,SAAS,EAC7F,QAAO;AAGT,QAAO;EACL,GAAG;EACH,QAAQ;GACN,GAAG,gBAAgB;GACnB,UAAU,CAAC,kCAAkC;GAC9C;EACF"}
package/dist/utils.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-ByKO4r7w.cjs");
3
3
  const require_getFooter = require("./getFooter-gshcRE1-.cjs");
4
- const require_requestBody = require("./requestBody-CLLG-M_R.cjs");
4
+ const require_requestBody = require("./requestBody-h1zQvUgJ.cjs");
5
5
  const require_SchemaMapper = require("./SchemaMapper-CeavHZlp.cjs");
6
6
  let _kubb_oas = require("@kubb/oas");
7
7
  let _kubb_ast = require("@kubb/ast");
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":["#options","camelCase","#transformParam","#eachParam","SchemaGenerator","schemaKeywords","camelCase","camelCase"],"sources":["../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../src/utils/getComments.ts","../src/utils/getImports.ts","../src/utils/getParams.ts","../src/utils/getSchemas.ts","../src/utils/paramsCasing.ts"],"sourcesContent":["/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Prefixes `word` with `_` when it is a reserved JavaScript/Java identifier or starts with a digit.\n *\n * @example\n * ```ts\n * transformReservedWord('class') // '_class'\n * transformReservedWord('42foo') // '_42foo'\n * transformReservedWord('status') // 'status'\n * ```\n */\nexport function transformReservedWord(word: string): string {\n const firstChar = word.charCodeAt(0)\n if (word && (reservedWords.has(word as 'valueOf') || (firstChar >= 48 && firstChar <= 57))) {\n return `_${word}`\n }\n return word\n}\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n try {\n new Function(`var ${name}`)\n } catch {\n return false\n }\n return true\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').getParams()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter((x): x is string => Boolean(x))\n .flatMap((text) => {\n return text.split(/\\r?\\n/).map((line) => line.trim())\n })\n .filter((x): x is string => Boolean(x))\n}\n","import { createImport } from '@kubb/ast'\nimport type { ImportNode } from '@kubb/ast/types'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport type { Schema } from '../SchemaMapper'\nimport { schemaKeywords } from '../SchemaMapper'\n\n/**\n * Get imports from a schema tree by extracting all ref schemas that are importable\n */\nexport function getImports(tree: Array<Schema>): Array<ImportNode> {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n if (!refs) return []\n\n return refs\n .map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return createImport({\n name: [item.args.name],\n path: item.args.path,\n })\n })\n .filter((x): x is NonNullable<typeof x> => x !== undefined)\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\nimport type { FunctionParamsAST } from '@kubb/core'\nimport type { OasTypes } from '@kubb/oas'\nimport type { Params } from '@kubb/react-fabric/types'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n casing,\n override,\n }: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema?.schema.properties || !operationSchema.name) {\n return []\n }\n\n const requiredFields = Array.isArray(operationSchema.schema.required) ? operationSchema.schema.required : []\n\n return Object.entries(operationSchema.schema.properties).map(([name]: [string, OasTypes.SchemaObject]) => {\n // Use camelCase name for indexed access if casing is enabled\n const accessName = casing === 'camelcase' ? camelCase(name) : name\n\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: requiredFields.includes(name),\n type: typed ? `${operationSchema.name}[\"${accessName}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = curr.name\n\n // Only transform to camelCase if explicitly requested\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n } else if (!isValidVarName(name)) {\n // If not valid variable name and casing not set, still need to make it valid\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n\n/**\n * Get a mapping of camelCase parameter names to their original names\n * Used for mapping function parameters to backend parameter names\n */\nexport function getParamsMapping(\n operationSchema: OperationSchema | undefined,\n options: {\n casing?: 'camelcase'\n } = {},\n): Record<string, string> | undefined {\n if (!operationSchema?.schema.properties) {\n return undefined\n }\n\n const allEntries: Array<[string, string]> = []\n let hasTransformation = false\n\n Object.entries(operationSchema.schema.properties).forEach(([originalName]) => {\n let transformedName = originalName\n\n // Only transform to camelCase if explicitly requested\n if (options.casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n // If not valid variable name and casing not set, still need to make it valid\n transformedName = camelCase(originalName)\n }\n\n allEntries.push([originalName, transformedName])\n\n if (transformedName !== originalName) {\n hasTransformation = true\n }\n })\n\n // When using explicit casing and there are transformations, include ALL params so that\n // mappedParams contains every parameter (not just the ones whose names changed).\n // This prevents params with already-camelCase names (e.g. 'page', 'search') from being\n // silently dropped when other params in the same schema do need transformation.\n if (options.casing === 'camelcase' && hasTransformation) {\n return Object.fromEntries(allEntries)\n }\n\n // When casing is not specified or no transformations are needed, only return changed entries\n const mapping: Record<string, string> = {}\n allEntries.forEach(([originalName, transformedName]) => {\n if (transformedName !== originalName) {\n mapping[originalName] = transformedName\n }\n })\n\n return Object.keys(mapping).length > 0 ? mapping : undefined\n}\n","import type { contentType, Oas, OasTypes } from '@kubb/oas'\n\nexport type GetSchemasResult = {\n schemas: Record<string, OasTypes.SchemaObject>\n /**\n * Mapping from original component name to resolved name after collision handling\n * e.g., { 'Order': 'OrderSchema', 'variant': 'variant2' }\n */\n nameMapping: Map<string, string>\n}\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n /**\n * Whether to resolve name collisions with suffixes.\n * If not provided, uses oas.options.collisionDetection\n * @default false (from oas.options or fallback)\n */\n collisionDetection?: boolean\n}\n\n/**\n * Collect schemas from OpenAPI components (schemas, responses, requestBodies)\n * and return them in dependency order along with name mapping for collision resolution.\n *\n * This function is a wrapper around the oas.getSchemas() method for backward compatibility.\n * New code should use oas.getSchemas() directly.\n *\n * @deprecated Use oas.getSchemas() instead\n */\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'], collisionDetection }: GetSchemasProps): GetSchemasResult {\n return oas.getSchemas({\n contentType,\n includes,\n collisionDetection,\n })\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\nimport type { SchemaObject } from '@kubb/oas'\n\n/**\n * Apply casing transformation to schema properties\n * Only transforms property names, not nested schemas\n */\nexport function applyParamsCasing(schema: SchemaObject, casing: 'camelcase' | undefined): SchemaObject {\n if (!casing || !schema.properties) {\n return schema\n }\n\n const transformedProperties: Record<string, any> = {}\n const transformedRequired: string[] = []\n\n // Transform property names\n Object.entries(schema.properties).forEach(([originalName, propertySchema]) => {\n let transformedName = originalName\n\n if (casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n // If not valid variable name, make it valid\n transformedName = camelCase(originalName)\n }\n\n transformedProperties[transformedName] = propertySchema\n })\n\n // Transform required field names\n if (Array.isArray(schema.required)) {\n schema.required.forEach((originalName) => {\n let transformedName = originalName\n\n if (casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n transformedName = camelCase(originalName)\n }\n\n transformedRequired.push(transformedName)\n })\n }\n\n // Return a new schema with transformed properties and required fields\n return {\n ...schema,\n properties: transformedProperties,\n ...(transformedRequired.length > 0 && { required: transformedRequired }),\n } as SchemaObject\n}\n\n/**\n * Check if this schema is a parameter schema (pathParams, queryParams, or headerParams)\n * Only these should be transformed, not response/data/body\n */\nexport function isParameterSchema(schemaName: string): boolean {\n const lowerName = schemaName.toLowerCase()\n return lowerName.includes('pathparams') || lowerName.includes('queryparams') || lowerName.includes('headerparams')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoHA,SAAgB,eAAe,MAAuB;AACpD,KAAI;AACF,MAAI,SAAS,OAAO,OAAO;SACrB;AACN,SAAO;;AAET,QAAO;;;;;;;;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BAAAA,UAAU,aAAa;AAG3C,sBAAoB,KAAK,gBAAgB;GACzC;AAIJ,QAAO;EACL,GAAG;EACH,YAAY;EACZ,GAAI,oBAAoB,SAAS,KAAK,EAAE,UAAU,qBAAqB;EACxE;;;;;;AAOH,SAAgB,kBAAkB,YAA6B;CAC7D,MAAM,YAAY,WAAW,aAAa;AAC1C,QAAO,UAAU,SAAS,aAAa,IAAI,UAAU,SAAS,cAAc,IAAI,UAAU,SAAS,eAAe"}
1
+ {"version":3,"file":"utils.cjs","names":["#options","camelCase","#transformParam","#eachParam","SchemaGenerator","schemaKeywords","camelCase","camelCase"],"sources":["../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../src/utils/getComments.ts","../src/utils/getImports.ts","../src/utils/getParams.ts","../src/utils/getSchemas.ts","../src/utils/paramsCasing.ts"],"sourcesContent":["/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Prefixes `word` with `_` when it is a reserved JavaScript/Java identifier or starts with a digit.\n *\n * @example\n * ```ts\n * transformReservedWord('class') // '_class'\n * transformReservedWord('42foo') // '_42foo'\n * transformReservedWord('status') // 'status'\n * ```\n */\nexport function transformReservedWord(word: string): string {\n const firstChar = word.charCodeAt(0)\n if (word && (reservedWords.has(word as 'valueOf') || (firstChar >= 48 && firstChar <= 57))) {\n return `_${word}`\n }\n return word\n}\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n try {\n new Function(`var ${name}`)\n } catch {\n return false\n }\n return true\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.getParams()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.getParams(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').getParams()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n getParams(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport type { Operation } from '@kubb/oas'\n\nexport function getComments(operation: Operation): string[] {\n return [\n operation.getDescription() && `@description ${operation.getDescription()}`,\n operation.getSummary() && `@summary ${operation.getSummary()}`,\n operation.path && `{@link ${new URLPath(operation.path).URL}}`,\n operation.isDeprecated() && '@deprecated',\n ]\n .filter((x): x is string => Boolean(x))\n .flatMap((text) => {\n return text.split(/\\r?\\n/).map((line) => line.trim())\n })\n .filter((x): x is string => Boolean(x))\n}\n","import { createImport } from '@kubb/ast'\nimport type { ImportNode } from '@kubb/ast/types'\nimport { SchemaGenerator } from '../SchemaGenerator.ts'\nimport type { Schema } from '../SchemaMapper'\nimport { schemaKeywords } from '../SchemaMapper'\n\n/**\n * Get imports from a schema tree by extracting all ref schemas that are importable\n */\nexport function getImports(tree: Array<Schema>): Array<ImportNode> {\n const refs = SchemaGenerator.deepSearch(tree, schemaKeywords.ref)\n\n if (!refs) return []\n\n return refs\n .map((item) => {\n if (!item.args.path || !item.args.isImportable) {\n return undefined\n }\n\n return createImport({\n name: [item.args.name],\n path: item.args.path,\n })\n })\n .filter((x): x is NonNullable<typeof x> => x !== undefined)\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\nimport type { FunctionParamsAST, Params } from '@kubb/core'\nimport type { OasTypes } from '@kubb/oas'\nimport type { OperationSchema } from '../types.ts'\n/**\n *\n * @deprecated\n * TODO move to operationManager hook\n */\nexport function getASTParams(\n operationSchema: OperationSchema | undefined,\n {\n typed = false,\n casing,\n override,\n }: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n): FunctionParamsAST[] {\n if (!operationSchema?.schema.properties || !operationSchema.name) {\n return []\n }\n\n const requiredFields = Array.isArray(operationSchema.schema.required) ? operationSchema.schema.required : []\n\n return Object.entries(operationSchema.schema.properties).map(([name]: [string, OasTypes.SchemaObject]) => {\n // Use camelCase name for indexed access if casing is enabled\n const accessName = casing === 'camelcase' ? camelCase(name) : name\n\n const data: FunctionParamsAST = {\n name,\n enabled: !!name,\n required: requiredFields.includes(name),\n type: typed ? `${operationSchema.name}[\"${accessName}\"]` : undefined,\n }\n\n return override ? override(data) : data\n })\n}\n\nexport function getPathParams(\n operationSchema: OperationSchema | undefined,\n options: {\n typed?: boolean\n casing?: 'camelcase'\n override?: (data: FunctionParamsAST) => FunctionParamsAST\n } = {},\n) {\n return getASTParams(operationSchema, options).reduce((acc, curr) => {\n if (curr.name && curr.enabled) {\n let name = curr.name\n\n // Only transform to camelCase if explicitly requested\n if (options.casing === 'camelcase') {\n name = camelCase(name)\n } else if (!isValidVarName(name)) {\n // If not valid variable name and casing not set, still need to make it valid\n name = camelCase(name)\n }\n\n acc[name] = {\n default: curr.default,\n type: curr.type,\n optional: !curr.required,\n }\n }\n\n return acc\n }, {} as Params)\n}\n\n/**\n * Get a mapping of camelCase parameter names to their original names\n * Used for mapping function parameters to backend parameter names\n */\nexport function getParamsMapping(\n operationSchema: OperationSchema | undefined,\n options: {\n casing?: 'camelcase'\n } = {},\n): Record<string, string> | undefined {\n if (!operationSchema?.schema.properties) {\n return undefined\n }\n\n const allEntries: Array<[string, string]> = []\n let hasTransformation = false\n\n Object.entries(operationSchema.schema.properties).forEach(([originalName]) => {\n let transformedName = originalName\n\n // Only transform to camelCase if explicitly requested\n if (options.casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n // If not valid variable name and casing not set, still need to make it valid\n transformedName = camelCase(originalName)\n }\n\n allEntries.push([originalName, transformedName])\n\n if (transformedName !== originalName) {\n hasTransformation = true\n }\n })\n\n // When using explicit casing and there are transformations, include ALL params so that\n // mappedParams contains every parameter (not just the ones whose names changed).\n // This prevents params with already-camelCase names (e.g. 'page', 'search') from being\n // silently dropped when other params in the same schema do need transformation.\n if (options.casing === 'camelcase' && hasTransformation) {\n return Object.fromEntries(allEntries)\n }\n\n // When casing is not specified or no transformations are needed, only return changed entries\n const mapping: Record<string, string> = {}\n allEntries.forEach(([originalName, transformedName]) => {\n if (transformedName !== originalName) {\n mapping[originalName] = transformedName\n }\n })\n\n return Object.keys(mapping).length > 0 ? mapping : undefined\n}\n","import type { contentType, Oas, OasTypes } from '@kubb/oas'\n\nexport type GetSchemasResult = {\n schemas: Record<string, OasTypes.SchemaObject>\n /**\n * Mapping from original component name to resolved name after collision handling\n * e.g., { 'Order': 'OrderSchema', 'variant': 'variant2' }\n */\n nameMapping: Map<string, string>\n}\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n /**\n * Whether to resolve name collisions with suffixes.\n * If not provided, uses oas.options.collisionDetection\n * @default false (from oas.options or fallback)\n */\n collisionDetection?: boolean\n}\n\n/**\n * Collect schemas from OpenAPI components (schemas, responses, requestBodies)\n * and return them in dependency order along with name mapping for collision resolution.\n *\n * This function is a wrapper around the oas.getSchemas() method for backward compatibility.\n * New code should use oas.getSchemas() directly.\n *\n * @deprecated Use oas.getSchemas() instead\n */\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'], collisionDetection }: GetSchemasProps): GetSchemasResult {\n return oas.getSchemas({\n contentType,\n includes,\n collisionDetection,\n })\n}\n","import { camelCase, isValidVarName } from '@internals/utils'\nimport type { SchemaObject } from '@kubb/oas'\n\n/**\n * Apply casing transformation to schema properties\n * Only transforms property names, not nested schemas\n */\nexport function applyParamsCasing(schema: SchemaObject, casing: 'camelcase' | undefined): SchemaObject {\n if (!casing || !schema.properties) {\n return schema\n }\n\n const transformedProperties: Record<string, any> = {}\n const transformedRequired: string[] = []\n\n // Transform property names\n Object.entries(schema.properties).forEach(([originalName, propertySchema]) => {\n let transformedName = originalName\n\n if (casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n // If not valid variable name, make it valid\n transformedName = camelCase(originalName)\n }\n\n transformedProperties[transformedName] = propertySchema\n })\n\n // Transform required field names\n if (Array.isArray(schema.required)) {\n schema.required.forEach((originalName) => {\n let transformedName = originalName\n\n if (casing === 'camelcase') {\n transformedName = camelCase(originalName)\n } else if (!isValidVarName(originalName)) {\n transformedName = camelCase(originalName)\n }\n\n transformedRequired.push(transformedName)\n })\n }\n\n // Return a new schema with transformed properties and required fields\n return {\n ...schema,\n properties: transformedProperties,\n ...(transformedRequired.length > 0 && { required: transformedRequired }),\n } as SchemaObject\n}\n\n/**\n * Check if this schema is a parameter schema (pathParams, queryParams, or headerParams)\n * Only these should be transformed, not response/data/body\n */\nexport function isParameterSchema(schemaName: string): boolean {\n const lowerName = schemaName.toLowerCase()\n return lowerName.includes('pathparams') || lowerName.includes('queryparams') || lowerName.includes('headerparams')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoHA,SAAgB,eAAe,MAAuB;AACpD,KAAI;AACF,MAAI,SAAS,OAAO,OAAO;SACrB;AACN,SAAO;;AAET,QAAO;;;;;;;;;;;;ACvET,IAAa,UAAb,MAAqB;;;;CAInB;CAEA;CAEA,YAAY,MAAc,UAAmB,EAAE,EAAE;AAC/C,OAAK,OAAO;AACZ,QAAA,UAAgB;;;;;;;;;CAUlB,IAAI,MAAc;AAChB,SAAO,KAAK,WAAW;;;;;;;;;;CAWzB,IAAI,QAAiB;AACnB,MAAI;AACF,UAAO,CAAC,CAAC,IAAI,IAAI,KAAK,KAAK,CAAC;UACtB;AACN,UAAO;;;;;;;;;;CAWX,IAAI,WAAmB;AACrB,SAAO,KAAK,kBAAkB;;;;;;;;;;CAWhC,IAAI,SAA6B;AAC/B,SAAO,KAAK,UAAU;;;;;;;;;;CAWxB,IAAI,SAA6C;AAC/C,SAAO,KAAK,WAAW;;CAGzB,gBAAgB,KAAqB;EACnC,MAAM,QAAQ,eAAe,IAAI,GAAG,MAAMC,kBAAAA,UAAU,IAAI;AACxD,SAAO,MAAA,QAAc,WAAW,cAAcA,kBAAAA,UAAU,MAAM,GAAG;;;;;CAMnE,WAAW,IAAgD;AACzD,OAAK,MAAM,SAAS,KAAK,KAAK,SAAS,eAAe,EAAE;GACtD,MAAM,MAAM,MAAM;AAClB,MAAG,KAAK,MAAA,eAAqB,IAAI,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ACrB,QAAO;CAGT,MAAM,wBAA6C,EAAE;CACrD,MAAM,sBAAgC,EAAE;AAGxC,QAAO,QAAQ,OAAO,WAAW,CAAC,SAAS,CAAC,cAAc,oBAAoB;EAC5E,IAAI,kBAAkB;AAEtB,MAAI,WAAW,YACb,mBAAkBC,kBAAAA,UAAU,aAAa;WAChC,CAAC,eAAe,aAAa,CAEtC,mBAAkBA,kBAAAA,UAAU,aAAa;AAG3C,wBAAsB,mBAAmB;GACzC;AAGF,KAAI,MAAM,QAAQ,OAAO,SAAS,CAChC,QAAO,SAAS,SAAS,iBAAiB;EACxC,IAAI,kBAAkB;AAEtB,MAAI,WAAW,YACb,mBAAkBA,kBAAAA,UAAU,aAAa;WAChC,CAAC,eAAe,aAAa,CACtC,mBAAkBA,kBAAAA,UAAU,aAAa;AAG3C,sBAAoB,KAAK,gBAAgB;GACzC;AAIJ,QAAO;EACL,GAAG;EACH,YAAY;EACZ,GAAI,oBAAoB,SAAS,KAAK,EAAE,UAAU,qBAAqB;EACxE;;;;;;AAOH,SAAgB,kBAAkB,YAA6B;CAC7D,MAAM,YAAY,WAAW,aAAa;AAC1C,QAAO,UAAU,SAAS,aAAa,IAAI,UAAU,SAAS,cAAc,IAAI,UAAU,SAAS,eAAe"}
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { h as OperationSchema } from "./createGenerator-DIWR4PRm.js";
2
+ import { h as OperationSchema } from "./createGenerator-CRvsKIrl.js";
3
3
  import { t as Schema } from "./SchemaMapper-KHABtXIZ.js";
4
4
  import { Oas, OasTypes, OpenAPIV3, OpenAPIV3_1, Operation, SchemaObject, contentType, isOptional } from "@kubb/oas";
5
- import { Config, FunctionParamsAST, Output } from "@kubb/core";
5
+ import { Config, FunctionParamsAST, Output, Params } from "@kubb/core";
6
6
  import { ImportNode } from "@kubb/ast/types";
7
- import { Params } from "@kubb/react-fabric/types";
8
7
 
9
8
  //#region src/utils/getBanner.d.ts
10
9
  type Props$1<TOas extends Oas> = {
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
2
  import { n as getBanner, r as camelCase, t as getFooter } from "./getFooter-Dz4u5Mg4.js";
3
- import { n as withRequiredRequestBodySchema, r as SchemaGenerator, s as getSchemaFactory, t as isRequestBodyRequired } from "./requestBody-BWuWn6Xp.js";
3
+ import { n as withRequiredRequestBodySchema, r as SchemaGenerator, s as getSchemaFactory, t as isRequestBodyRequired } from "./requestBody-DMoaqEak.js";
4
4
  import { n as schemaKeywords } from "./SchemaMapper-CqMkO2T1.js";
5
5
  import { isOptional } from "@kubb/oas";
6
6
  import { createImport } from "@kubb/ast";