@kubb/plugin-oas 5.0.0-alpha.6 → 5.0.0-alpha.8

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 (35) hide show
  1. package/dist/{createGenerator-B_7cgcmg.d.ts → createGenerator-BnX0BloB.d.ts} +4 -4
  2. package/dist/{generators-D_7I5QrN.cjs → generators-BfTTScuN.cjs} +4 -4
  3. package/dist/{generators-D_7I5QrN.cjs.map → generators-BfTTScuN.cjs.map} +1 -1
  4. package/dist/{generators-DxN9Dqyi.js → generators-BjsINk-u.js} +4 -4
  5. package/dist/{generators-DxN9Dqyi.js.map → generators-BjsINk-u.js.map} +1 -1
  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 +14 -14
  10. package/dist/hooks.cjs.map +1 -1
  11. package/dist/hooks.d.ts +1 -1
  12. package/dist/hooks.js +15 -15
  13. package/dist/hooks.js.map +1 -1
  14. package/dist/index.cjs +9 -9
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +5 -5
  17. package/dist/index.js +10 -10
  18. package/dist/index.js.map +1 -1
  19. package/dist/{requestBody-BWo89xcg.cjs → requestBody-DyTNWJql.cjs} +17 -17
  20. package/dist/requestBody-DyTNWJql.cjs.map +1 -0
  21. package/dist/{requestBody-Cs-1vKOq.js → requestBody-gV_d8sCu.js} +17 -17
  22. package/dist/requestBody-gV_d8sCu.js.map +1 -0
  23. package/dist/utils.cjs +1 -1
  24. package/dist/utils.d.ts +1 -1
  25. package/dist/utils.js +1 -1
  26. package/package.json +3 -3
  27. package/src/OperationGenerator.ts +6 -6
  28. package/src/SchemaGenerator.ts +8 -8
  29. package/src/generators/jsonGenerator.ts +3 -3
  30. package/src/hooks/useOperationManager.ts +12 -12
  31. package/src/hooks/useSchemaManager.ts +4 -4
  32. package/src/plugin.ts +4 -4
  33. package/src/utils.tsx +14 -14
  34. package/dist/requestBody-BWo89xcg.cjs.map +0 -1
  35. package/dist/requestBody-Cs-1vKOq.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestBody-gV_d8sCu.js","names":["#head","#tail","#size","#options","#context","#nameMappingInitialized","#schemaNameMapping","#getOptions","#parseCache","#parseSchemaObject","#getUnknownType","#ensureNameMapping","#getRefAlias","#getParsedSchemaObject","#getEmptyType","#addDiscriminatorToSchema","#wouldCreateCircularReference","#parseProperties","#doBuild"],"sources":["../../../internals/utils/src/names.ts","../../../internals/utils/src/string.ts","../../../internals/utils/src/object.ts","../../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/p-limit@7.3.0/node_modules/p-limit/index.js","../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/**\n * Registers `originalName` in `data` without altering the returned name.\n * Use this when you need to track usage frequency but always emit the original identifier.\n */\nexport function setUniqueName(originalName: string, data: Record<string, number>): string {\n let used = data[originalName] || 0\n if (used) {\n data[originalName] = ++used\n return originalName\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 */\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","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 * Serializes plugin options for safe JSON transport.\n * Strips functions, symbols, and `undefined` values recursively.\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 * 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 | undefined {\n const parts = Array.isArray(param) ? param : param.split('.')\n if (parts.length === 0 || (parts.length === 1 && parts[0] === '')) return undefined\n return `${accessor}?.['${`${parts.join(\"']?.['\")}']`}`\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\n\t\t// Clean up tail reference when queue becomes empty\n\t\tif (!this.#head) {\n\t\t\tthis.#tail = undefined;\n\t\t}\n\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tlet rejectOnClear = false;\n\n\tif (typeof concurrency === 'object') {\n\t\t({concurrency, rejectOnClear = false} = concurrency);\n\t}\n\n\tvalidateConcurrency(concurrency);\n\n\tif (typeof rejectOnClear !== 'boolean') {\n\t\tthrow new TypeError('Expected `rejectOnClear` to be a boolean');\n\t}\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\t// Process the next queued function if we're under the concurrency limit\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tactiveCount++;\n\t\t\tqueue.dequeue().run();\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\t// Execute the function and capture the result promise\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\t// Resolve immediately with the promise (don't wait for completion)\n\t\tresolve(result);\n\n\t\t// Wait for the function to complete (success or failure)\n\t\t// We catch errors here to prevent unhandled rejections,\n\t\t// but the original promise rejection is preserved for the caller\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\t// Decrement active count and process next queued function\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, reject, arguments_) => {\n\t\tconst queueItem = {reject};\n\n\t\t// Queue the internal resolve function instead of the run function\n\t\t// to preserve the asynchronous execution context.\n\t\tnew Promise(internalResolve => { // eslint-disable-line promise/param-names\n\t\t\tqueueItem.run = internalResolve;\n\t\t\tqueue.enqueue(queueItem);\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_)); // eslint-disable-line promise/prefer-await-to-then\n\n\t\t// Start processing immediately if we haven't reached the concurrency limit\n\t\tif (activeCount < concurrency) {\n\t\t\tresumeNext();\n\t\t}\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise((resolve, reject) => {\n\t\tenqueue(function_, resolve, reject, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tif (!rejectOnClear) {\n\t\t\t\t\tqueue.clear();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst abortError = AbortSignal.abort().reason;\n\n\t\t\t\twhile (queue.size > 0) {\n\t\t\t\t\tqueue.dequeue().reject(abortError);\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t\tmap: {\n\t\t\tasync value(iterable, function_) {\n\t\t\t\tconst promises = Array.from(iterable, (value, index) => this(function_, value, index));\n\t\t\t\treturn Promise.all(promises);\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, options) {\n\tconst limit = pLimit(options);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\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 { OperationNode, SchemaNode } from '@kubb/ast/types'\nimport type { Adapter, Config, Plugin, PluginDriver, PluginFactoryOptions, ReactGeneratorV2 } from '@kubb/core'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { createReactFabric, Fabric } from '@kubb/react-fabric'\nimport type { Fabric as FabricType } from '@kubb/react-fabric/types'\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 BuildOperationsBaseOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: FabricType\n plugin: Plugin<TOptions>\n}\n\ntype BuildOperationsV1Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<TOptions>['Operations']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\ntype BuildOperationsV2Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGeneratorV2<TOptions>['Operations'] | undefined\n adapter: Adapter\n driver: PluginDriver\n mode: KubbFile.Mode\n options: TOptions['resolvedOptions']\n}\n\nfunction isBuildOperationsV1Options<TOptions extends PluginFactoryOptions>(\n options: BuildOperationsV1Options<TOptions> | BuildOperationsV2Options<TOptions>,\n): options is BuildOperationsV1Options<TOptions> {\n return (options.version ?? '1') === '1'\n}\n\nexport async function buildOperations<TOptions extends PluginFactoryOptions>(\n operations: Array<Operation>,\n options: BuildOperationsV1Options<TOptions>,\n): Promise<void>\nexport async function buildOperations<TOptions extends PluginFactoryOptions>(\n nodes: Array<OperationNode>,\n options: BuildOperationsV2Options<TOptions>,\n): Promise<void>\nexport async function buildOperations<TOptions extends PluginFactoryOptions>(\n operationsOrNodes: Array<Operation> | Array<OperationNode>,\n options: BuildOperationsV1Options<TOptions> | BuildOperationsV2Options<TOptions>,\n): Promise<void> {\n const { config, fabric, plugin } = options\n\n if (!options.Component) {\n return undefined\n }\n\n const fabricChild = createReactFabric()\n\n if (isBuildOperationsV1Options(options)) {\n const { generator, Component } = options\n const { driver, oas, mode } = generator.context\n\n await fabricChild.render(\n <Fabric meta={{ driver, plugin, mode, oas }}>\n <Component config={config} operations={operationsOrNodes as Array<Operation>} generator={generator} plugin={plugin} />\n </Fabric>,\n )\n } else {\n const { Component, adapter } = options\n\n await fabricChild.render(\n <Fabric meta={{ plugin }}>\n <Component config={config} adapter={adapter} nodes={operationsOrNodes as Array<OperationNode>} options={options.options} />\n </Fabric>,\n )\n }\n\n fabric.context.fileManager.upsert(...fabricChild.files)\n fabricChild.unmount()\n}\n\ntype BuildOperationBaseOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: FabricType\n plugin: Plugin<TOptions>\n}\n\ntype BuildOperationV1Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<TOptions>['Operation']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\ntype BuildOperationV2Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGeneratorV2<TOptions>['Operation'] | undefined\n adapter: Adapter\n driver: PluginDriver\n mode: KubbFile.Mode\n options: TOptions['resolvedOptions']\n}\n\nfunction isBuildOperationV1Options<TOptions extends PluginFactoryOptions>(\n options: BuildOperationV1Options<TOptions> | BuildOperationV2Options<TOptions>,\n): options is BuildOperationV1Options<TOptions> {\n return (options.version ?? '1') === '1'\n}\n\nexport async function buildOperation<TOptions extends PluginFactoryOptions>(operation: Operation, options: BuildOperationV1Options<TOptions>): Promise<void>\nexport async function buildOperation<TOptions extends PluginFactoryOptions>(node: OperationNode, options: BuildOperationV2Options<TOptions>): Promise<void>\nexport async function buildOperation<TOptions extends PluginFactoryOptions>(\n operationOrNode: Operation | OperationNode,\n options: BuildOperationV1Options<TOptions> | BuildOperationV2Options<TOptions>,\n): Promise<void> {\n const { config, fabric, plugin } = options\n\n if (!options.Component) {\n return undefined\n }\n\n const fabricChild = createReactFabric()\n\n if (isBuildOperationV1Options(options)) {\n const { generator, Component } = options\n const { driver, oas, mode } = generator.context\n\n await fabricChild.render(\n <Fabric meta={{ driver, plugin, mode, oas }}>\n <Component config={config} operation={operationOrNode as Operation} plugin={plugin} generator={generator} />\n </Fabric>,\n )\n } else {\n const { Component, adapter, driver, mode } = options\n\n await fabricChild.render(\n <Fabric meta={{ plugin, driver, mode }}>\n <Component config={config} adapter={adapter} node={operationOrNode as OperationNode} options={options.options} />\n </Fabric>,\n )\n }\n\n fabric.context.fileManager.upsert(...fabricChild.files)\n fabricChild.unmount()\n}\n\ntype BuildSchemaBaseOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: FabricType\n plugin: Plugin<TOptions>\n}\n\ntype BuildSchemaV1Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<TOptions>['Schema']\n generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n}\n\ntype BuildSchemaV2Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGeneratorV2<TOptions>['Schema'] | undefined\n adapter: Adapter\n driver: PluginDriver\n mode: KubbFile.Mode\n options: TOptions['resolvedOptions']\n}\n\nfunction isBuildSchemaV1Options<TOptions extends PluginFactoryOptions>(\n options: BuildSchemaV1Options<TOptions> | BuildSchemaV2Options<TOptions>,\n): options is BuildSchemaV1Options<TOptions> {\n return (options.version ?? '1') === '1'\n}\n\nexport async function buildSchema<TOptions extends PluginFactoryOptions>(\n schema: { name: string; tree: Array<Schema>; value: SchemaObject },\n options: BuildSchemaV1Options<TOptions>,\n): Promise<void>\nexport async function buildSchema<TOptions extends PluginFactoryOptions>(schema: SchemaNode, options: BuildSchemaV2Options<TOptions>): Promise<void>\nexport async function buildSchema<TOptions extends PluginFactoryOptions>(\n schema: { name: string; tree: Array<Schema>; value: SchemaObject } | SchemaNode,\n options: BuildSchemaV1Options<TOptions> | BuildSchemaV2Options<TOptions>,\n): Promise<void> {\n const { config, fabric, plugin } = options\n\n if (!options.Component) {\n return undefined\n }\n\n const fabricChild = createReactFabric()\n\n if (isBuildSchemaV1Options(options)) {\n const { generator, Component } = options\n const { driver, oas, mode } = generator.context\n\n await fabricChild.render(\n <Fabric meta={{ driver, plugin, mode, oas }}>\n <Component config={config} schema={schema as { name: string; tree: Array<Schema>; value: SchemaObject }} plugin={plugin} generator={generator} />\n </Fabric>,\n )\n } else {\n const { Component, adapter, driver, mode } = options\n\n await fabricChild.render(\n <Fabric meta={{ plugin, driver, mode }}>\n <Component config={config} adapter={adapter} node={schema as SchemaNode} options={options.options} />\n </Fabric>,\n )\n }\n\n fabric.context.fileManager.upsert(...fabricChild.files)\n\n fabricChild.unmount()\n}\n","import { getUniqueName, pascalCase, stringify } from '@internals/utils'\nimport type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginDriver, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'\nimport type { Fabric as FabricType, KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, OasTypes, OpenAPIV3, SchemaObject } from '@kubb/oas'\nimport { isDiscriminator, isNullable, isReference, KUBB_INLINE_REF_PREFIX } from '@kubb/oas'\nimport pLimit from 'p-limit'\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 { buildSchema } 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<KubbFile.File<TFileMeta> | Array<KubbFile.File<TFileMeta>> | null>\n\n/** Max concurrent generator tasks (across generators). */\nconst GENERATOR_CONCURRENCY = 3\n/** Max concurrent schema parsing tasks (per generator). */\nconst SCHEMA_CONCURRENCY = 30\n\ntype Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {\n fabric: FabricType\n oas: Oas\n driver: PluginDriver\n events?: AsyncEventEmitter<KubbEvents>\n /**\n * Current plugin\n */\n plugin: Plugin<TPluginOptions>\n mode: KubbFile.Mode\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<KubbFile.File<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<KubbFile.File<TFileMeta>>> {\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(GENERATOR_CONCURRENCY)\n const schemaLimit = pLimit(SCHEMA_CONCURRENCY)\n\n const writeTasks = generators.map((generator) =>\n generatorLimit(async () => {\n if (generator.version === '2') {\n return []\n }\n\n // After the v2 guard above, all generators here are v1\n const v1Generator = generator as ReactGenerator<TPluginOptions> | CoreGenerator<TPluginOptions>\n\n const schemaTasks = schemaEntries.map(([name, schemaObject]) =>\n schemaLimit(async () => {\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 buildSchema(\n {\n name,\n value: schemaObject as SchemaObject,\n tree,\n },\n {\n config: this.context.driver.config,\n fabric: this.context.fabric,\n Component: v1Generator.Schema,\n generator: this,\n plugin: {\n ...this.context.plugin,\n options: {\n ...this.options,\n ...options,\n },\n },\n },\n )\n\n return []\n }\n\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 },\n },\n })\n\n return result ?? []\n }),\n )\n\n const schemaResults = await Promise.all(schemaTasks)\n return schemaResults.flat() as unknown as KubbFile.File<TFileMeta>\n }),\n )\n\n const nestedResults = await Promise.all(writeTasks)\n\n return nestedResults.flat()\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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AAW,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-BBzsC616.cjs");
4
- const require_requestBody = require("./requestBody-BWo89xcg.cjs");
4
+ const require_requestBody = require("./requestBody-DyTNWJql.cjs");
5
5
  const require_SchemaMapper = require("./SchemaMapper-CeavHZlp.cjs");
6
6
  let _kubb_oas = require("@kubb/oas");
7
7
  //#region ../../internals/utils/src/reserved.ts
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { h as OperationSchema } from "./createGenerator-B_7cgcmg.js";
2
+ import { h as OperationSchema } from "./createGenerator-BnX0BloB.js";
3
3
  import { t as Schema } from "./SchemaMapper-SneuY1wg.js";
4
4
  import { Oas, OasTypes, OpenAPIV3, OpenAPIV3_1, Operation, SchemaObject, contentType, isOptional } from "@kubb/oas";
5
5
  import { Config, FunctionParamsAST, Output } from "@kubb/core";
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-Pw3tLCiV.js";
3
- import { n as withRequiredRequestBodySchema, r as SchemaGenerator, s as getSchemaFactory, t as isRequestBodyRequired } from "./requestBody-Cs-1vKOq.js";
3
+ import { n as withRequiredRequestBodySchema, r as SchemaGenerator, s as getSchemaFactory, t as isRequestBodyRequired } from "./requestBody-gV_d8sCu.js";
4
4
  import { n as schemaKeywords } from "./SchemaMapper-CqMkO2T1.js";
5
5
  import { isOptional } from "@kubb/oas";
6
6
  //#region ../../internals/utils/src/reserved.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-oas",
3
- "version": "5.0.0-alpha.6",
3
+ "version": "5.0.0-alpha.8",
4
4
  "description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -84,8 +84,8 @@
84
84
  "@kubb/fabric-core": "0.14.0",
85
85
  "@kubb/react-fabric": "0.14.0",
86
86
  "remeda": "^2.33.6",
87
- "@kubb/oas": "5.0.0-alpha.6",
88
- "@kubb/core": "5.0.0-alpha.6"
87
+ "@kubb/core": "5.0.0-alpha.8",
88
+ "@kubb/oas": "5.0.0-alpha.8"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "@kubb/fabric-core": "0.14.0",
@@ -1,5 +1,5 @@
1
1
  import { pascalCase } from '@internals/utils'
2
- import type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginFactoryOptions, PluginManager } from '@kubb/core'
2
+ import type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginDriver, PluginFactoryOptions } from '@kubb/core'
3
3
  import type { Fabric as FabricType, KubbFile } from '@kubb/fabric-core/types'
4
4
  import type { contentType, HttpMethod, Oas, OasTypes, Operation, SchemaObject } from '@kubb/oas'
5
5
  import pLimit from 'p-limit'
@@ -19,7 +19,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
19
19
  include: Array<Include> | undefined
20
20
  override: Array<Override<TOptions>> | undefined
21
21
  contentType: contentType | undefined
22
- pluginManager: PluginManager
22
+ driver: PluginDriver
23
23
  events?: AsyncEventEmitter<KubbEvents>
24
24
  /**
25
25
  * Current plugin
@@ -234,7 +234,7 @@ export class OperationGenerator<TPluginOptions extends PluginFactoryOptions = Pl
234
234
 
235
235
  if (v1Generator.type === 'react') {
236
236
  await buildOperation(operation, {
237
- config: this.context.pluginManager.config,
237
+ config: this.context.driver.config,
238
238
  fabric: this.context.fabric,
239
239
  Component: v1Generator.Operation,
240
240
  generator: this,
@@ -252,7 +252,7 @@ export class OperationGenerator<TPluginOptions extends PluginFactoryOptions = Pl
252
252
 
253
253
  const result = await v1Generator.operation?.({
254
254
  generator: this,
255
- config: this.context.pluginManager.config,
255
+ config: this.context.driver.config,
256
256
  operation,
257
257
  plugin: {
258
258
  ...this.context.plugin,
@@ -275,7 +275,7 @@ export class OperationGenerator<TPluginOptions extends PluginFactoryOptions = Pl
275
275
  operations.map((op) => op.operation),
276
276
  {
277
277
  fabric: this.context.fabric,
278
- config: this.context.pluginManager.config,
278
+ config: this.context.driver.config,
279
279
  Component: v1Generator.Operations,
280
280
  generator: this,
281
281
  plugin: this.context.plugin,
@@ -287,7 +287,7 @@ export class OperationGenerator<TPluginOptions extends PluginFactoryOptions = Pl
287
287
 
288
288
  const operationsResult = await v1Generator.operations?.({
289
289
  generator: this,
290
- config: this.context.pluginManager.config,
290
+ config: this.context.driver.config,
291
291
  operations: operations.map((op) => op.operation),
292
292
  plugin: this.context.plugin,
293
293
  })
@@ -1,5 +1,5 @@
1
1
  import { getUniqueName, pascalCase, stringify } from '@internals/utils'
2
- import type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'
2
+ import type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginDriver, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
3
3
  import type { Fabric as FabricType, KubbFile } from '@kubb/fabric-core/types'
4
4
  import type { contentType, Oas, OasTypes, OpenAPIV3, SchemaObject } from '@kubb/oas'
5
5
  import { isDiscriminator, isNullable, isReference, KUBB_INLINE_REF_PREFIX } from '@kubb/oas'
@@ -25,7 +25,7 @@ const SCHEMA_CONCURRENCY = 30
25
25
  type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
26
26
  fabric: FabricType
27
27
  oas: Oas
28
- pluginManager: PluginManager
28
+ driver: PluginDriver
29
29
  events?: AsyncEventEmitter<KubbEvents>
30
30
  /**
31
31
  * Current plugin
@@ -523,18 +523,18 @@ export class SchemaGenerator<
523
523
  // Use the full $ref path to look up the collision-resolved name
524
524
  const resolvedName = this.#schemaNameMapping.get($ref) || originalName
525
525
 
526
- const propertyName = this.context.pluginManager.resolveName({
526
+ const propertyName = this.context.driver.resolveName({
527
527
  name: resolvedName,
528
528
  pluginName: this.context.plugin.name,
529
529
  type: 'function',
530
530
  })
531
531
 
532
- const fileName = this.context.pluginManager.resolveName({
532
+ const fileName = this.context.driver.resolveName({
533
533
  name: resolvedName,
534
534
  pluginName: this.context.plugin.name,
535
535
  type: 'file',
536
536
  })
537
- const file = this.context.pluginManager.getFile({
537
+ const file = this.context.driver.getFile({
538
538
  name: fileName,
539
539
  pluginName: this.context.plugin.name,
540
540
  extname: '.ts',
@@ -967,7 +967,7 @@ export class SchemaGenerator<
967
967
  const enumName = useCollisionDetection
968
968
  ? pascalCase(enumNameParts.join(' '))
969
969
  : getUniqueName(pascalCase(enumNameParts.join(' ')), this.options.usedEnumNames || {})
970
- const typeName = this.context.pluginManager.resolveName({
970
+ const typeName = this.context.driver.resolveName({
971
971
  name: enumName,
972
972
  pluginName: this.context.plugin.name,
973
973
  type: 'type',
@@ -1388,7 +1388,7 @@ export class SchemaGenerator<
1388
1388
  tree,
1389
1389
  },
1390
1390
  {
1391
- config: this.context.pluginManager.config,
1391
+ config: this.context.driver.config,
1392
1392
  fabric: this.context.fabric,
1393
1393
  Component: v1Generator.Schema,
1394
1394
  generator: this,
@@ -1406,7 +1406,7 @@ export class SchemaGenerator<
1406
1406
  }
1407
1407
 
1408
1408
  const result = await v1Generator.schema?.({
1409
- config: this.context.pluginManager.config,
1409
+ config: this.context.driver.config,
1410
1410
  generator: this,
1411
1411
  schema: {
1412
1412
  name,
@@ -7,8 +7,8 @@ import { createGenerator } from './createGenerator.ts'
7
7
  export const jsonGenerator = createGenerator<PluginOas>({
8
8
  name: 'plugin-oas',
9
9
  async schema({ schema, generator }) {
10
- const { pluginManager, plugin } = generator.context
11
- const file = pluginManager.getFile({
10
+ const { driver, plugin } = generator.context
11
+ const file = driver.getFile({
12
12
  name: camelCase(schema.name),
13
13
  extname: '.json',
14
14
  mode: 'split',
@@ -29,7 +29,7 @@ export const jsonGenerator = createGenerator<PluginOas>({
29
29
  banner: getBanner({
30
30
  oas: generator.context.oas,
31
31
  output: plugin.options.output,
32
- config: pluginManager.config,
32
+ config: driver.config,
33
33
  }),
34
34
  format: getFooter({ oas: generator.context.oas, output: plugin.options.output }),
35
35
  },
@@ -1,5 +1,5 @@
1
1
  import type { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
- import { usePlugin, usePluginManager } from '@kubb/core/hooks'
2
+ import { usePlugin, usePluginDriver } from '@kubb/core/hooks'
3
3
  import type { KubbFile } from '@kubb/fabric-core/types'
4
4
  import type { Operation, Operation as OperationType } from '@kubb/oas'
5
5
  import type { OperationGenerator } from '../OperationGenerator.ts'
@@ -66,10 +66,10 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
66
66
  generator: Omit<OperationGenerator<TPluginOptions>, 'build'>,
67
67
  ): UseOperationManagerResult {
68
68
  const plugin = usePlugin()
69
- const pluginManager = usePluginManager()
69
+ const driver = usePluginDriver()
70
70
 
71
71
  const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginName = plugin.name, type }) => {
72
- return pluginManager.resolveName({
72
+ return driver.resolveName({
73
73
  name: `${prefix} ${operation.getOperationId()} ${suffix}`,
74
74
  pluginName,
75
75
  type,
@@ -90,7 +90,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
90
90
 
91
91
  return generator.getSchemas(operation, {
92
92
  resolveName: (name) =>
93
- pluginManager.resolveName({
93
+ driver.resolveName({
94
94
  name,
95
95
  pluginName: params?.pluginName,
96
96
  type: params?.type,
@@ -102,7 +102,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
102
102
  const name = getName(operation, { type: 'file', pluginName, prefix, suffix })
103
103
  const group = getGroup(operation)
104
104
 
105
- const file = pluginManager.getFile({
105
+ const file = driver.getFile({
106
106
  name,
107
107
  extname,
108
108
  pluginName,
@@ -133,7 +133,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
133
133
  return prev
134
134
  }
135
135
 
136
- prev[acc.statusCode] = pluginManager.resolveName({
136
+ prev[acc.statusCode] = driver.resolveName({
137
137
  name: acc.name,
138
138
  pluginName,
139
139
  type,
@@ -150,7 +150,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
150
150
  return prev
151
151
  }
152
152
 
153
- prev[acc.statusCode] = pluginManager.resolveName({
153
+ prev[acc.statusCode] = driver.resolveName({
154
154
  name: acc.name,
155
155
  pluginName,
156
156
  type,
@@ -163,7 +163,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
163
163
 
164
164
  return {
165
165
  request: schemas.request?.name
166
- ? pluginManager.resolveName({
166
+ ? driver.resolveName({
167
167
  name: schemas.request.name,
168
168
  pluginName,
169
169
  type,
@@ -171,21 +171,21 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
171
171
  : undefined,
172
172
  parameters: {
173
173
  path: schemas.pathParams?.name
174
- ? pluginManager.resolveName({
174
+ ? driver.resolveName({
175
175
  name: schemas.pathParams.name,
176
176
  pluginName,
177
177
  type,
178
178
  })
179
179
  : undefined,
180
180
  query: schemas.queryParams?.name
181
- ? pluginManager.resolveName({
181
+ ? driver.resolveName({
182
182
  name: schemas.queryParams.name,
183
183
  pluginName,
184
184
  type,
185
185
  })
186
186
  : undefined,
187
187
  header: schemas.headerParams?.name
188
- ? pluginManager.resolveName({
188
+ ? driver.resolveName({
189
189
  name: schemas.headerParams.name,
190
190
  pluginName,
191
191
  type,
@@ -194,7 +194,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
194
194
  },
195
195
  responses: {
196
196
  ...responses,
197
- ['default']: pluginManager.resolveName({
197
+ ['default']: driver.resolveName({
198
198
  name: schemas.response.name,
199
199
  pluginName,
200
200
  type,
@@ -1,5 +1,5 @@
1
1
  import type { FileMetaBase, ResolveNameParams } from '@kubb/core'
2
- import { usePlugin, usePluginManager } from '@kubb/core/hooks'
2
+ import { usePlugin, usePluginDriver } from '@kubb/core/hooks'
3
3
  import type { KubbFile } from '@kubb/fabric-core/types'
4
4
 
5
5
  type FileMeta = FileMetaBase & {
@@ -33,10 +33,10 @@ type UseSchemaManagerResult = {
33
33
  */
34
34
  export function useSchemaManager(): UseSchemaManagerResult {
35
35
  const plugin = usePlugin()
36
- const pluginManager = usePluginManager()
36
+ const driver = usePluginDriver()
37
37
 
38
38
  const getName: UseSchemaManagerResult['getName'] = (name, { pluginName = plugin.name, type }) => {
39
- return pluginManager.resolveName({
39
+ return driver.resolveName({
40
40
  name,
41
41
  pluginName,
42
42
  type,
@@ -46,7 +46,7 @@ export function useSchemaManager(): UseSchemaManagerResult {
46
46
  const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginName = plugin.name, extname = '.ts', group } = {}) => {
47
47
  const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginName })
48
48
 
49
- const file = pluginManager.getFile({
49
+ const file = driver.getFile({
50
50
  name: resolvedName,
51
51
  extname,
52
52
  pluginName,
package/src/plugin.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path'
2
2
  import { camelCase } from '@internals/utils'
3
3
  import type { AsyncEventEmitter } from '@kubb/core'
4
- import { type Config, definePlugin, type Group, getMode, type KubbEvents } from '@kubb/core'
4
+ import { type Config, createPlugin, type Group, getMode, type KubbEvents } from '@kubb/core'
5
5
  import type { Oas } from '@kubb/oas'
6
6
  import { parseFromConfig, resolveServerUrl } from '@kubb/oas'
7
7
  import { jsonGenerator } from './generators'
@@ -11,7 +11,7 @@ import type { PluginOas } from './types.ts'
11
11
 
12
12
  export const pluginOasName = 'plugin-oas' satisfies PluginOas['name']
13
13
 
14
- export const pluginOas = definePlugin<PluginOas>((options) => {
14
+ export const pluginOas = createPlugin<PluginOas>((options) => {
15
15
  const {
16
16
  output = {
17
17
  path: 'schemas',
@@ -152,7 +152,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
152
152
  {
153
153
  fabric: this.fabric,
154
154
  oas,
155
- pluginManager: this.pluginManager,
155
+ driver: this.driver,
156
156
  events: this.events,
157
157
  plugin: this.plugin,
158
158
  contentType,
@@ -169,7 +169,7 @@ export const pluginOas = definePlugin<PluginOas>((options) => {
169
169
  const operationGenerator = new OperationGenerator(this.plugin.options, {
170
170
  fabric: this.fabric,
171
171
  oas,
172
- pluginManager: this.pluginManager,
172
+ driver: this.driver,
173
173
  events: this.events,
174
174
  plugin: this.plugin,
175
175
  contentType,