@kubb/plugin-oas 5.0.0-alpha.1 → 5.0.0-alpha.2
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.
- package/dist/{createGenerator-CBXpHeVY.d.ts → createGenerator-B8BypXNu.d.ts} +4 -4
- package/dist/{generators-D7C3CXsN.js → generators-B8HiBWvT.js} +2 -2
- package/dist/{generators-D7C3CXsN.js.map → generators-B8HiBWvT.js.map} +1 -1
- package/dist/{generators-CyWd3UXA.cjs → generators-vAAte6w6.cjs} +2 -2
- package/dist/{generators-CyWd3UXA.cjs.map → generators-vAAte6w6.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/hooks.cjs +23 -23
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +10 -10
- package/dist/hooks.js +23 -23
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{requestBody-mUXoBwsu.js → requestBody-DQMKhTin.js} +5 -5
- package/dist/requestBody-DQMKhTin.js.map +1 -0
- package/dist/{requestBody-DIM-iDpM.cjs → requestBody-FpiwLR1p.cjs} +5 -5
- package/dist/requestBody-FpiwLR1p.cjs.map +1 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +3 -3
- package/src/SchemaGenerator.ts +4 -4
- package/src/generators/jsonGenerator.ts +1 -1
- package/src/hooks/useOperationManager.ts +22 -22
- package/src/hooks/useSchemaManager.ts +11 -11
- package/src/plugin.ts +1 -1
- package/src/types.ts +4 -4
- package/dist/requestBody-DIM-iDpM.cjs.map +0 -1
- package/dist/requestBody-mUXoBwsu.js.map +0 -1
package/src/SchemaGenerator.ts
CHANGED
|
@@ -526,18 +526,18 @@ export class SchemaGenerator<
|
|
|
526
526
|
|
|
527
527
|
const propertyName = this.context.pluginManager.resolveName({
|
|
528
528
|
name: resolvedName,
|
|
529
|
-
|
|
529
|
+
pluginName: this.context.plugin.name,
|
|
530
530
|
type: 'function',
|
|
531
531
|
})
|
|
532
532
|
|
|
533
533
|
const fileName = this.context.pluginManager.resolveName({
|
|
534
534
|
name: resolvedName,
|
|
535
|
-
|
|
535
|
+
pluginName: this.context.plugin.name,
|
|
536
536
|
type: 'file',
|
|
537
537
|
})
|
|
538
538
|
const file = this.context.pluginManager.getFile({
|
|
539
539
|
name: fileName,
|
|
540
|
-
|
|
540
|
+
pluginName: this.context.plugin.name,
|
|
541
541
|
extname: '.ts',
|
|
542
542
|
})
|
|
543
543
|
|
|
@@ -970,7 +970,7 @@ export class SchemaGenerator<
|
|
|
970
970
|
: getUniqueName(pascalCase(enumNameParts.join(' ')), this.options.usedEnumNames || {})
|
|
971
971
|
const typeName = this.context.pluginManager.resolveName({
|
|
972
972
|
name: enumName,
|
|
973
|
-
|
|
973
|
+
pluginName: this.context.plugin.name,
|
|
974
974
|
type: 'type',
|
|
975
975
|
})
|
|
976
976
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileMetaBase,
|
|
1
|
+
import type { FileMetaBase, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
import { usePlugin, usePluginManager } 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'
|
|
@@ -6,7 +6,7 @@ import type { OperationGenerator } from '../OperationGenerator.ts'
|
|
|
6
6
|
import type { OperationSchemas } from '../types.ts'
|
|
7
7
|
|
|
8
8
|
type FileMeta = FileMetaBase & {
|
|
9
|
-
|
|
9
|
+
pluginName: string
|
|
10
10
|
name: string
|
|
11
11
|
group?: {
|
|
12
12
|
tag?: string
|
|
@@ -31,7 +31,7 @@ type UseOperationManagerResult = {
|
|
|
31
31
|
params: {
|
|
32
32
|
prefix?: string
|
|
33
33
|
suffix?: string
|
|
34
|
-
|
|
34
|
+
pluginName?: string
|
|
35
35
|
type: ResolveNameParams['type']
|
|
36
36
|
},
|
|
37
37
|
) => string
|
|
@@ -40,7 +40,7 @@ type UseOperationManagerResult = {
|
|
|
40
40
|
params?: {
|
|
41
41
|
prefix?: string
|
|
42
42
|
suffix?: string
|
|
43
|
-
|
|
43
|
+
pluginName?: string
|
|
44
44
|
extname?: KubbFile.Extname
|
|
45
45
|
group?: {
|
|
46
46
|
tag?: string
|
|
@@ -51,11 +51,11 @@ type UseOperationManagerResult = {
|
|
|
51
51
|
groupSchemasByName: (
|
|
52
52
|
operation: OperationType,
|
|
53
53
|
params: {
|
|
54
|
-
|
|
54
|
+
pluginName?: string
|
|
55
55
|
type: ResolveNameParams['type']
|
|
56
56
|
},
|
|
57
57
|
) => SchemaNames
|
|
58
|
-
getSchemas: (operation: Operation, params?: {
|
|
58
|
+
getSchemas: (operation: Operation, params?: { pluginName?: string; type?: ResolveNameParams['type'] }) => OperationSchemas
|
|
59
59
|
getGroup: (operation: Operation) => FileMeta['group'] | undefined
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -68,10 +68,10 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
68
68
|
const plugin = usePlugin()
|
|
69
69
|
const pluginManager = usePluginManager()
|
|
70
70
|
|
|
71
|
-
const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '',
|
|
71
|
+
const getName: UseOperationManagerResult['getName'] = (operation, { prefix = '', suffix = '', pluginName = plugin.name, type }) => {
|
|
72
72
|
return pluginManager.resolveName({
|
|
73
73
|
name: `${prefix} ${operation.getOperationId()} ${suffix}`,
|
|
74
|
-
|
|
74
|
+
pluginName,
|
|
75
75
|
type,
|
|
76
76
|
})
|
|
77
77
|
}
|
|
@@ -92,21 +92,21 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
92
92
|
resolveName: (name) =>
|
|
93
93
|
pluginManager.resolveName({
|
|
94
94
|
name,
|
|
95
|
-
|
|
95
|
+
pluginName: params?.pluginName,
|
|
96
96
|
type: params?.type,
|
|
97
97
|
}),
|
|
98
98
|
})
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix,
|
|
102
|
-
const name = getName(operation, { type: 'file',
|
|
101
|
+
const getFile: UseOperationManagerResult['getFile'] = (operation, { prefix, suffix, pluginName = plugin.name, extname = '.ts' } = {}) => {
|
|
102
|
+
const name = getName(operation, { type: 'file', pluginName, prefix, suffix })
|
|
103
103
|
const group = getGroup(operation)
|
|
104
104
|
|
|
105
105
|
const file = pluginManager.getFile({
|
|
106
106
|
name,
|
|
107
107
|
extname,
|
|
108
|
-
|
|
109
|
-
options: { type: 'file',
|
|
108
|
+
pluginName,
|
|
109
|
+
options: { type: 'file', pluginName, group },
|
|
110
110
|
})
|
|
111
111
|
|
|
112
112
|
return {
|
|
@@ -114,13 +114,13 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
114
114
|
meta: {
|
|
115
115
|
...file.meta,
|
|
116
116
|
name,
|
|
117
|
-
|
|
117
|
+
pluginName,
|
|
118
118
|
group,
|
|
119
119
|
},
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, {
|
|
123
|
+
const groupSchemasByName: UseOperationManagerResult['groupSchemasByName'] = (operation, { pluginName = plugin.name, type }) => {
|
|
124
124
|
if (!generator) {
|
|
125
125
|
throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`)
|
|
126
126
|
}
|
|
@@ -135,7 +135,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
135
135
|
|
|
136
136
|
prev[acc.statusCode] = pluginManager.resolveName({
|
|
137
137
|
name: acc.name,
|
|
138
|
-
|
|
138
|
+
pluginName,
|
|
139
139
|
type,
|
|
140
140
|
})
|
|
141
141
|
|
|
@@ -152,7 +152,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
152
152
|
|
|
153
153
|
prev[acc.statusCode] = pluginManager.resolveName({
|
|
154
154
|
name: acc.name,
|
|
155
|
-
|
|
155
|
+
pluginName,
|
|
156
156
|
type,
|
|
157
157
|
})
|
|
158
158
|
|
|
@@ -165,7 +165,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
165
165
|
request: schemas.request?.name
|
|
166
166
|
? pluginManager.resolveName({
|
|
167
167
|
name: schemas.request.name,
|
|
168
|
-
|
|
168
|
+
pluginName,
|
|
169
169
|
type,
|
|
170
170
|
})
|
|
171
171
|
: undefined,
|
|
@@ -173,21 +173,21 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
173
173
|
path: schemas.pathParams?.name
|
|
174
174
|
? pluginManager.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
181
|
? pluginManager.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
188
|
? pluginManager.resolveName({
|
|
189
189
|
name: schemas.headerParams.name,
|
|
190
|
-
|
|
190
|
+
pluginName,
|
|
191
191
|
type,
|
|
192
192
|
})
|
|
193
193
|
: undefined,
|
|
@@ -196,7 +196,7 @@ export function useOperationManager<TPluginOptions extends PluginFactoryOptions
|
|
|
196
196
|
...responses,
|
|
197
197
|
['default']: pluginManager.resolveName({
|
|
198
198
|
name: schemas.response.name,
|
|
199
|
-
|
|
199
|
+
pluginName,
|
|
200
200
|
type,
|
|
201
201
|
}),
|
|
202
202
|
...errors,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FileMetaBase,
|
|
1
|
+
import type { FileMetaBase, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
import { usePlugin, usePluginManager } from '@kubb/core/hooks'
|
|
3
3
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
4
4
|
|
|
5
5
|
type FileMeta = FileMetaBase & {
|
|
6
|
-
|
|
6
|
+
pluginName: string
|
|
7
7
|
name: string
|
|
8
8
|
group?: {
|
|
9
9
|
tag?: string
|
|
@@ -12,11 +12,11 @@ type FileMeta = FileMetaBase & {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
type UseSchemaManagerResult = {
|
|
15
|
-
getName: (name: string, params: {
|
|
15
|
+
getName: (name: string, params: { pluginName?: string; type: ResolveNameParams['type'] }) => string
|
|
16
16
|
getFile: (
|
|
17
17
|
name: string,
|
|
18
18
|
params?: {
|
|
19
|
-
|
|
19
|
+
pluginName?: string
|
|
20
20
|
mode?: KubbFile.Mode
|
|
21
21
|
extname?: KubbFile.Extname
|
|
22
22
|
group?: {
|
|
@@ -34,22 +34,22 @@ export function useSchemaManager(): UseSchemaManagerResult {
|
|
|
34
34
|
const plugin = usePlugin()
|
|
35
35
|
const pluginManager = usePluginManager()
|
|
36
36
|
|
|
37
|
-
const getName: UseSchemaManagerResult['getName'] = (name, {
|
|
37
|
+
const getName: UseSchemaManagerResult['getName'] = (name, { pluginName = plugin.name, type }) => {
|
|
38
38
|
return pluginManager.resolveName({
|
|
39
39
|
name,
|
|
40
|
-
|
|
40
|
+
pluginName,
|
|
41
41
|
type,
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split',
|
|
46
|
-
const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file',
|
|
45
|
+
const getFile: UseSchemaManagerResult['getFile'] = (name, { mode = 'split', pluginName = plugin.name, extname = '.ts', group } = {}) => {
|
|
46
|
+
const resolvedName = mode === 'single' ? '' : getName(name, { type: 'file', pluginName })
|
|
47
47
|
|
|
48
48
|
const file = pluginManager.getFile({
|
|
49
49
|
name: resolvedName,
|
|
50
50
|
extname,
|
|
51
|
-
|
|
52
|
-
options: { type: 'file',
|
|
51
|
+
pluginName,
|
|
52
|
+
options: { type: 'file', pluginName, group },
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
return {
|
|
@@ -57,7 +57,7 @@ export function useSchemaManager(): UseSchemaManagerResult {
|
|
|
57
57
|
meta: {
|
|
58
58
|
...file.meta,
|
|
59
59
|
name: resolvedName,
|
|
60
|
-
|
|
60
|
+
pluginName,
|
|
61
61
|
},
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/plugin.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Group, Output,
|
|
1
|
+
import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
|
|
2
2
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
3
3
|
|
|
4
4
|
import type { contentType, HttpMethod, Oas, Operation, SchemaObject } from '@kubb/oas'
|
|
@@ -20,7 +20,7 @@ declare global {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export type ResolvePathOptions = {
|
|
23
|
-
|
|
23
|
+
pluginName?: string
|
|
24
24
|
group?: {
|
|
25
25
|
tag?: string
|
|
26
26
|
path?: string
|
|
@@ -136,14 +136,14 @@ export type Options = {
|
|
|
136
136
|
*
|
|
137
137
|
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
138
138
|
*
|
|
139
|
-
* `
|
|
139
|
+
* `pluginName` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
140
140
|
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
141
141
|
*/
|
|
142
142
|
export type Ref = {
|
|
143
143
|
propertyName: string
|
|
144
144
|
originalName: string
|
|
145
145
|
path: KubbFile.Path
|
|
146
|
-
|
|
146
|
+
pluginName?: string
|
|
147
147
|
}
|
|
148
148
|
export type Refs = Record<string, Ref>
|
|
149
149
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requestBody-DIM-iDpM.cjs","names":["#head","#tail","#size","App","#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","../../../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 { Config, Plugin, PluginFactoryOptions } from '@kubb/core'\nimport type { Operation, SchemaObject } from '@kubb/oas'\nimport { App, createReactFabric, type Fabric } from '@kubb/react-fabric'\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: Fabric\n plugin: Plugin<TOptions>\n}\n\ntype BuildOperationsV1Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<any, '1'>['Operations']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\ntype BuildOperationsV2Options<TOptions extends PluginFactoryOptions> = BuildOperationsBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGenerator<any, '2'>['Operations']\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 { pluginManager, oas, mode } = generator.context\n\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operationsOrNodes as Array<Operation>} generator={generator} plugin={plugin} />\n </App>,\n )\n } else {\n const { Component } = options\n await fabricChild.render(\n <App meta={{ plugin }}>\n <Component config={config} nodes={operationsOrNodes as Array<OperationNode>} plugin={plugin} />\n </App>,\n )\n }\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n fabricChild.unmount()\n}\n\ntype BuildOperationBaseOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: Fabric\n plugin: Plugin<TOptions>\n}\n\ntype BuildOperationV1Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<any, '1'>['Operation']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n}\n\ntype BuildOperationV2Options<TOptions extends PluginFactoryOptions> = BuildOperationBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGenerator<any, '2'>['Operation']\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 { pluginManager, oas, mode } = generator.context\n\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operationOrNode as Operation} plugin={plugin} generator={generator} />\n </App>,\n )\n } else {\n const { Component } = options\n await fabricChild.render(\n <App meta={{ plugin }}>\n <Component config={config} node={operationOrNode as OperationNode} plugin={plugin} />\n </App>,\n )\n }\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n fabricChild.unmount()\n}\n\ntype BuildSchemaBaseOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: Fabric\n plugin: Plugin<TOptions>\n}\n\ntype BuildSchemaV1Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {\n version?: '1'\n Component: ReactGenerator<any, '1'>['Schema']\n generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n}\n\ntype BuildSchemaV2Options<TOptions extends PluginFactoryOptions> = BuildSchemaBaseOptions<TOptions> & {\n version: '2'\n Component: ReactGenerator<any, '2'>['Schema']\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 { pluginManager, oas, mode } = generator.context\n\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema as { name: string; tree: Array<Schema>; value: SchemaObject }} plugin={plugin} generator={generator} />\n </App>,\n )\n } else {\n const { Component } = options\n await fabricChild.render(\n <App meta={{ plugin }}>\n <Component config={config} node={schema as SchemaNode} plugin={plugin} />\n </App>,\n )\n }\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n fabricChild.unmount()\n}\n","import { getUniqueName, pascalCase, stringify } from '@internals/utils'\nimport type { AsyncEventEmitter, FileMetaBase, KubbEvents, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport type { 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 type { Fabric } from '@kubb/react-fabric'\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, Version } 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: Fabric\n oas: Oas\n pluginManager: PluginManager\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.pluginManager.resolveName({\n name: resolvedName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: resolvedName,\n pluginKey: this.context.plugin.key,\n type: 'file',\n })\n const file = this.context.pluginManager.getFile({\n name: fileName,\n pluginKey: this.context.plugin.key,\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.pluginManager.resolveName({\n name: enumName,\n pluginKey: this.context.plugin.key,\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, Version>>): 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(\n schemas: Record<string, OasTypes.SchemaObject>,\n generators: Array<Generator<TPluginOptions, Version>>,\n ): 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, '1'> | CoreGenerator<TPluginOptions, '1'>\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.pluginManager.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.pluginManager.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}\n"],"x_google_ignoreList":[3,4],"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;;;;;;;;;;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