@kubb/plugin-oas 4.18.5 → 4.19.1
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/{SchemaGenerator-DExEah4y.js → SchemaGenerator-CK_Mv0RW.js} +90 -39
- package/dist/SchemaGenerator-CK_Mv0RW.js.map +1 -0
- package/dist/{SchemaGenerator-B18-jWu7.cjs → SchemaGenerator-D2ZpjZgn.cjs} +91 -40
- package/dist/SchemaGenerator-D2ZpjZgn.cjs.map +1 -0
- package/dist/{SchemaMapper-oZdVAbXF.d.ts → SchemaMapper-DI2vHHE0.d.ts} +24 -7
- package/dist/{SchemaMapper-BWZ2ZjPQ.d.cts → SchemaMapper-DmB5NyNo.d.cts} +24 -7
- package/dist/{createGenerator-Bq76G0TY.d.ts → createGenerator-3zJdjpOn.d.ts} +38 -2
- package/dist/{createGenerator-RL6jHKJ-.d.cts → createGenerator-cYz-kExA.d.cts} +38 -2
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/getSchemaFactory-CBp1me72.cjs +29 -0
- package/dist/getSchemaFactory-CBp1me72.cjs.map +1 -0
- package/dist/getSchemaFactory-DsoVRgxV.js +24 -0
- package/dist/getSchemaFactory-DsoVRgxV.js.map +1 -0
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/utils.cjs +26 -3
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +25 -5
- package/dist/utils.d.ts +25 -5
- package/dist/utils.js +24 -1
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/SchemaGenerator.ts +90 -32
- package/src/plugin.ts +2 -0
- package/src/types.ts +30 -0
- package/src/utils/getSchemas.ts +27 -105
- package/dist/SchemaGenerator-B18-jWu7.cjs.map +0 -1
- package/dist/SchemaGenerator-DExEah4y.js.map +0 -1
- package/dist/getSchemas-BUXPwm-5.js +0 -101
- package/dist/getSchemas-BUXPwm-5.js.map +0 -1
- package/dist/getSchemas-D3YweIFO.cjs +0 -112
- package/dist/getSchemas-D3YweIFO.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C1_xRkKa.cjs');
|
|
2
2
|
const require_SchemaMapper = require('./SchemaMapper-CzH82C7C.cjs');
|
|
3
|
-
const
|
|
3
|
+
const require_getSchemaFactory = require('./getSchemaFactory-CBp1me72.cjs');
|
|
4
4
|
let _kubb_core = require("@kubb/core");
|
|
5
5
|
let _kubb_core_transformers = require("@kubb/core/transformers");
|
|
6
6
|
_kubb_core_transformers = require_chunk.__toESM(_kubb_core_transformers);
|
|
@@ -195,9 +195,23 @@ async function buildSchema(schema, { config, fabric, plugin, Component, generato
|
|
|
195
195
|
//#region src/SchemaGenerator.ts
|
|
196
196
|
var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
197
197
|
refs = {};
|
|
198
|
-
#
|
|
198
|
+
#schemaNameMapping = /* @__PURE__ */ new Map();
|
|
199
|
+
#nameMappingInitialized = false;
|
|
199
200
|
#parseCache = /* @__PURE__ */ new Map();
|
|
200
201
|
/**
|
|
202
|
+
* Ensure the name mapping is initialized (lazy initialization)
|
|
203
|
+
*/
|
|
204
|
+
#ensureNameMapping() {
|
|
205
|
+
if (this.#nameMappingInitialized) return;
|
|
206
|
+
const { oas, contentType, include } = this.context;
|
|
207
|
+
const { nameMapping } = oas.getSchemas({
|
|
208
|
+
contentType,
|
|
209
|
+
includes: include
|
|
210
|
+
});
|
|
211
|
+
this.#schemaNameMapping = nameMapping;
|
|
212
|
+
this.#nameMappingInitialized = true;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
201
215
|
* Creates a type node from a given schema.
|
|
202
216
|
* Delegates to getBaseTypeFromSchema internally and
|
|
203
217
|
* optionally adds a union with null.
|
|
@@ -210,7 +224,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
210
224
|
cacheKey = JSON.stringify({
|
|
211
225
|
schema: props.schema,
|
|
212
226
|
name: props.name,
|
|
213
|
-
parentName: props.parentName
|
|
227
|
+
parentName: props.parentName,
|
|
228
|
+
rootName: props.rootName
|
|
214
229
|
});
|
|
215
230
|
const cached = this.#parseCache.get(cacheKey);
|
|
216
231
|
if (cached) return cached;
|
|
@@ -322,7 +337,7 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
322
337
|
/**
|
|
323
338
|
* Recursively creates a type literal with the given props.
|
|
324
339
|
*/
|
|
325
|
-
#parseProperties(name, schemaObject) {
|
|
340
|
+
#parseProperties(name, schemaObject, rootName) {
|
|
326
341
|
const properties = schemaObject?.properties || {};
|
|
327
342
|
const additionalProperties = schemaObject?.additionalProperties;
|
|
328
343
|
const required = schemaObject?.required;
|
|
@@ -335,7 +350,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
335
350
|
validationFunctions.push(...this.parse({
|
|
336
351
|
schema: propertySchema,
|
|
337
352
|
name: propertyName,
|
|
338
|
-
parentName: name
|
|
353
|
+
parentName: name,
|
|
354
|
+
rootName: rootName || name
|
|
339
355
|
}));
|
|
340
356
|
validationFunctions.push({
|
|
341
357
|
keyword: require_SchemaMapper.schemaKeywords.name,
|
|
@@ -352,14 +368,16 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
352
368
|
if (additionalProperties) additionalPropertiesSchemas = additionalProperties === true || !Object.keys(additionalProperties).length ? [{ keyword: this.#getUnknownType(name) }] : this.parse({
|
|
353
369
|
schema: additionalProperties,
|
|
354
370
|
name: null,
|
|
355
|
-
parentName: name
|
|
371
|
+
parentName: name,
|
|
372
|
+
rootName: rootName || name
|
|
356
373
|
});
|
|
357
374
|
let patternPropertiesSchemas = {};
|
|
358
375
|
if (patternProperties && typeof patternProperties === "object") patternPropertiesSchemas = Object.entries(patternProperties).reduce((acc, [pattern, patternSchema]) => {
|
|
359
376
|
const schemas = patternSchema === true || !Object.keys(patternSchema).length ? [{ keyword: this.#getUnknownType(name) }] : this.parse({
|
|
360
377
|
schema: patternSchema,
|
|
361
378
|
name: null,
|
|
362
|
-
parentName: name
|
|
379
|
+
parentName: name,
|
|
380
|
+
rootName: rootName || name
|
|
363
381
|
});
|
|
364
382
|
return {
|
|
365
383
|
...acc,
|
|
@@ -419,14 +437,16 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
419
437
|
}
|
|
420
438
|
}];
|
|
421
439
|
}
|
|
422
|
-
|
|
440
|
+
this.#ensureNameMapping();
|
|
441
|
+
const originalName = $ref.replace(/.+\//, "");
|
|
442
|
+
const resolvedName = this.#schemaNameMapping.get($ref) || originalName;
|
|
423
443
|
const propertyName = this.context.pluginManager.resolveName({
|
|
424
|
-
name:
|
|
444
|
+
name: resolvedName,
|
|
425
445
|
pluginKey: this.context.plugin.key,
|
|
426
446
|
type: "function"
|
|
427
447
|
});
|
|
428
448
|
const fileName = this.context.pluginManager.resolveName({
|
|
429
|
-
name:
|
|
449
|
+
name: resolvedName,
|
|
430
450
|
pluginKey: this.context.plugin.key,
|
|
431
451
|
type: "file"
|
|
432
452
|
});
|
|
@@ -437,13 +457,13 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
437
457
|
});
|
|
438
458
|
this.refs[$ref] = {
|
|
439
459
|
propertyName,
|
|
440
|
-
originalName,
|
|
460
|
+
originalName: resolvedName,
|
|
441
461
|
path: file.path
|
|
442
462
|
};
|
|
443
463
|
return this.#getRefAlias(schemaObject, name);
|
|
444
464
|
}
|
|
445
465
|
#getParsedSchemaObject(schema) {
|
|
446
|
-
return
|
|
466
|
+
return require_getSchemaFactory.getSchemaFactory(this.context.oas)(schema);
|
|
447
467
|
}
|
|
448
468
|
#addDiscriminatorToSchema({ schema, schemaObject, discriminator }) {
|
|
449
469
|
if (!require_SchemaMapper.isKeyword(schema, require_SchemaMapper.schemaKeywords.union)) return schema;
|
|
@@ -451,7 +471,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
451
471
|
const objectPropertySchema = SchemaGenerator.find(this.parse({
|
|
452
472
|
schema: schemaObject,
|
|
453
473
|
name: null,
|
|
454
|
-
parentName: null
|
|
474
|
+
parentName: null,
|
|
475
|
+
rootName: null
|
|
455
476
|
}), require_SchemaMapper.schemaKeywords.object);
|
|
456
477
|
return {
|
|
457
478
|
...schema,
|
|
@@ -509,7 +530,7 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
509
530
|
* This is the very core of the OpenAPI to TS conversion - it takes a
|
|
510
531
|
* schema and returns the appropriate type.
|
|
511
532
|
*/
|
|
512
|
-
#parseSchemaObject({ schema: _schemaObject, name, parentName }) {
|
|
533
|
+
#parseSchemaObject({ schema: _schemaObject, name, parentName, rootName }) {
|
|
513
534
|
const normalizedSchema = this.context.oas.flattenSchema(_schemaObject);
|
|
514
535
|
const { schemaObject, version } = this.#getParsedSchemaObject(normalizedSchema);
|
|
515
536
|
const options = this.#getOptions(name);
|
|
@@ -580,7 +601,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
580
601
|
type: item
|
|
581
602
|
},
|
|
582
603
|
name,
|
|
583
|
-
parentName
|
|
604
|
+
parentName,
|
|
605
|
+
rootName
|
|
584
606
|
})[0]).filter(Boolean).map((item) => require_SchemaMapper.isKeyword(item, require_SchemaMapper.schemaKeywords.object) ? {
|
|
585
607
|
...item,
|
|
586
608
|
args: {
|
|
@@ -626,7 +648,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
626
648
|
return item && this.parse({
|
|
627
649
|
schema: item,
|
|
628
650
|
name,
|
|
629
|
-
parentName
|
|
651
|
+
parentName,
|
|
652
|
+
rootName
|
|
630
653
|
})[0];
|
|
631
654
|
}).filter(Boolean)
|
|
632
655
|
};
|
|
@@ -641,7 +664,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
641
664
|
const propertySchemas = this.parse({
|
|
642
665
|
schema: schemaWithoutOneOf,
|
|
643
666
|
name,
|
|
644
|
-
parentName
|
|
667
|
+
parentName,
|
|
668
|
+
rootName
|
|
645
669
|
});
|
|
646
670
|
union.args = [...union.args.map((arg) => {
|
|
647
671
|
return {
|
|
@@ -665,7 +689,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
665
689
|
return item ? this.parse({
|
|
666
690
|
schema: item,
|
|
667
691
|
name,
|
|
668
|
-
parentName
|
|
692
|
+
parentName,
|
|
693
|
+
rootName
|
|
669
694
|
}) : [];
|
|
670
695
|
}).filter(Boolean)
|
|
671
696
|
};
|
|
@@ -692,7 +717,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
692
717
|
const parsed = this.parse({
|
|
693
718
|
schema: item,
|
|
694
719
|
name,
|
|
695
|
-
parentName
|
|
720
|
+
parentName,
|
|
721
|
+
rootName
|
|
696
722
|
});
|
|
697
723
|
if (Array.isArray(parsed)) and.args = and.args ? and.args.concat(parsed) : parsed;
|
|
698
724
|
}
|
|
@@ -700,7 +726,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
700
726
|
if (schemaWithoutAllOf.properties) and.args = [...and.args || [], ...this.parse({
|
|
701
727
|
schema: schemaWithoutAllOf,
|
|
702
728
|
name,
|
|
703
|
-
parentName
|
|
729
|
+
parentName,
|
|
730
|
+
rootName
|
|
704
731
|
})];
|
|
705
732
|
return SchemaGenerator.combineObjects([and, ...baseItems]);
|
|
706
733
|
}
|
|
@@ -718,14 +745,22 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
718
745
|
return this.parse({
|
|
719
746
|
schema: normalizedSchema$1,
|
|
720
747
|
name,
|
|
721
|
-
parentName
|
|
748
|
+
parentName,
|
|
749
|
+
rootName
|
|
722
750
|
});
|
|
723
751
|
}
|
|
724
|
-
const
|
|
752
|
+
const useCollisionDetection = this.context.oas.options.collisionDetection ?? false;
|
|
753
|
+
const enumNameParts = useCollisionDetection && rootName && rootName !== parentName ? [
|
|
754
|
+
rootName,
|
|
725
755
|
parentName,
|
|
726
756
|
name,
|
|
727
757
|
options.enumSuffix
|
|
728
|
-
]
|
|
758
|
+
] : [
|
|
759
|
+
parentName,
|
|
760
|
+
name,
|
|
761
|
+
options.enumSuffix
|
|
762
|
+
];
|
|
763
|
+
const enumName = useCollisionDetection ? (0, _kubb_core_transformers.pascalCase)(enumNameParts.join(" ")) : (0, _kubb_core_utils.getUniqueName)((0, _kubb_core_transformers.pascalCase)(enumNameParts.join(" ")), this.options.usedEnumNames || {});
|
|
729
764
|
const typeName = this.context.pluginManager.resolveName({
|
|
730
765
|
name: enumName,
|
|
731
766
|
pluginKey: this.context.plugin.key,
|
|
@@ -821,13 +856,15 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
821
856
|
return this.parse({
|
|
822
857
|
schema: item,
|
|
823
858
|
name,
|
|
824
|
-
parentName
|
|
859
|
+
parentName,
|
|
860
|
+
rootName
|
|
825
861
|
})[0];
|
|
826
862
|
}).filter(Boolean),
|
|
827
863
|
rest: this.parse({
|
|
828
864
|
schema: items,
|
|
829
865
|
name,
|
|
830
|
-
parentName
|
|
866
|
+
parentName,
|
|
867
|
+
rootName
|
|
831
868
|
})[0]
|
|
832
869
|
}
|
|
833
870
|
}, ...baseItems.filter((item) => item.keyword !== require_SchemaMapper.schemaKeywords.min && item.keyword !== require_SchemaMapper.schemaKeywords.max)];
|
|
@@ -961,7 +998,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
961
998
|
const items = this.parse({
|
|
962
999
|
schema: "items" in schemaObject ? schemaObject.items : [],
|
|
963
1000
|
name,
|
|
964
|
-
parentName
|
|
1001
|
+
parentName,
|
|
1002
|
+
rootName
|
|
965
1003
|
});
|
|
966
1004
|
const unique = !!schemaObject.uniqueItems;
|
|
967
1005
|
return [{
|
|
@@ -989,9 +1027,9 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
989
1027
|
};
|
|
990
1028
|
return acc;
|
|
991
1029
|
}, schemaObject || {});
|
|
992
|
-
return [...this.#parseProperties(name, schemaObjectOverridden), ...baseItems];
|
|
1030
|
+
return [...this.#parseProperties(name, schemaObjectOverridden, rootName), ...baseItems];
|
|
993
1031
|
}
|
|
994
|
-
return [...this.#parseProperties(name, schemaObject), ...baseItems];
|
|
1032
|
+
return [...this.#parseProperties(name, schemaObject, rootName), ...baseItems];
|
|
995
1033
|
}
|
|
996
1034
|
if (schemaObject.type) {
|
|
997
1035
|
const type = Array.isArray(schemaObject.type) ? schemaObject.type.filter((item) => item !== "null")[0] : schemaObject.type;
|
|
@@ -1013,20 +1051,32 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
1013
1051
|
}
|
|
1014
1052
|
async build(...generators) {
|
|
1015
1053
|
const { oas, contentType, include } = this.context;
|
|
1016
|
-
|
|
1017
|
-
oas
|
|
1054
|
+
if (!this.#nameMappingInitialized) {
|
|
1055
|
+
const { schemas: schemas$1, nameMapping } = oas.getSchemas({
|
|
1056
|
+
contentType,
|
|
1057
|
+
includes: include
|
|
1058
|
+
});
|
|
1059
|
+
this.#schemaNameMapping = nameMapping;
|
|
1060
|
+
this.#nameMappingInitialized = true;
|
|
1061
|
+
const schemaEntries = Object.entries(schemas$1);
|
|
1062
|
+
this.context.events?.emit("debug", {
|
|
1063
|
+
date: /* @__PURE__ */ new Date(),
|
|
1064
|
+
logs: [
|
|
1065
|
+
`Building ${schemaEntries.length} schemas`,
|
|
1066
|
+
` • Content Type: ${contentType || "application/json"}`,
|
|
1067
|
+
` • Generators: ${generators.length}`
|
|
1068
|
+
]
|
|
1069
|
+
});
|
|
1070
|
+
return this.#doBuild(schemas$1, generators);
|
|
1071
|
+
}
|
|
1072
|
+
const { schemas } = oas.getSchemas({
|
|
1018
1073
|
contentType,
|
|
1019
1074
|
includes: include
|
|
1020
1075
|
});
|
|
1076
|
+
return this.#doBuild(schemas, generators);
|
|
1077
|
+
}
|
|
1078
|
+
async #doBuild(schemas, generators) {
|
|
1021
1079
|
const schemaEntries = Object.entries(schemas);
|
|
1022
|
-
this.context.events?.emit("debug", {
|
|
1023
|
-
date: /* @__PURE__ */ new Date(),
|
|
1024
|
-
logs: [
|
|
1025
|
-
`Building ${schemaEntries.length} schemas`,
|
|
1026
|
-
` • Content Type: ${contentType || "application/json"}`,
|
|
1027
|
-
` • Generators: ${generators.length}`
|
|
1028
|
-
]
|
|
1029
|
-
});
|
|
1030
1080
|
const generatorLimit = pLimit(3);
|
|
1031
1081
|
const schemaLimit = pLimit(30);
|
|
1032
1082
|
const writeTasks = generators.map((generator) => generatorLimit(async () => {
|
|
@@ -1035,7 +1085,8 @@ var SchemaGenerator = class SchemaGenerator extends _kubb_core.BaseGenerator {
|
|
|
1035
1085
|
const tree = this.parse({
|
|
1036
1086
|
schema: schemaObject,
|
|
1037
1087
|
name,
|
|
1038
|
-
parentName: null
|
|
1088
|
+
parentName: null,
|
|
1089
|
+
rootName: name
|
|
1039
1090
|
});
|
|
1040
1091
|
if (generator.type === "react") {
|
|
1041
1092
|
await buildSchema({
|
|
@@ -1111,4 +1162,4 @@ Object.defineProperty(exports, 'pLimit', {
|
|
|
1111
1162
|
return pLimit;
|
|
1112
1163
|
}
|
|
1113
1164
|
});
|
|
1114
|
-
//# sourceMappingURL=SchemaGenerator-
|
|
1165
|
+
//# sourceMappingURL=SchemaGenerator-D2ZpjZgn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaGenerator-D2ZpjZgn.cjs","names":["#head","#tail","#size","App","BaseGenerator","#nameMappingInitialized","#schemaNameMapping","#getOptions","#parseCache","#parseSchemaObject","isDeepEqual","isKeyword","schemaKeywords","#getUnknownType","#ensureNameMapping","#getRefAlias","getSchemaFactory","#getParsedSchemaObject","#getEmptyType","transformers","#addDiscriminatorToSchema","#wouldCreateCircularReference","normalizedSchema","name","min","max","#parseProperties","schemas","#doBuild"],"sources":["../../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js","../../../node_modules/.pnpm/p-limit@7.2.0/node_modules/p-limit/index.js","../src/utils.tsx","../src/SchemaGenerator.ts"],"sourcesContent":["/*\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\tvalidateConcurrency(concurrency);\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()();\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, arguments_) => {\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\tqueue.enqueue(internalResolve);\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 => {\n\t\tenqueue(function_, resolve, 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\tqueue.clear();\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 {concurrency} = options;\n\tconst limit = pLimit(concurrency);\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 { 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 BuildOperationsOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: Fabric\n Component: ReactGenerator<any>['Operations']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n plugin: Plugin<TOptions>\n}\n\nexport async function buildOperations<TOptions extends PluginFactoryOptions>(\n operations: Array<Operation>,\n { config, fabric, plugin, generator, Component }: BuildOperationsOptions<TOptions>,\n): Promise<void> {\n if (!Component) {\n return undefined\n }\n\n const { pluginManager, oas, mode } = generator.context\n\n const fabricChild = createReactFabric()\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operations} generator={generator} plugin={plugin} />\n </App>,\n )\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n\ntype BuildOperationOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: Fabric\n Component: ReactGenerator<any>['Operation']\n generator: Omit<OperationGenerator<TOptions>, 'build'>\n plugin: Plugin<TOptions>\n}\n\nexport async function buildOperation<TOptions extends PluginFactoryOptions>(\n operation: Operation,\n { config, fabric, plugin, generator, Component }: BuildOperationOptions<TOptions>,\n): Promise<void> {\n if (!Component) {\n return undefined\n }\n\n const { pluginManager, oas, mode } = generator.context\n\n const fabricChild = createReactFabric()\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operation} plugin={plugin} generator={generator} />\n </App>,\n )\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n\ntype BuildSchemaOptions<TOptions extends PluginFactoryOptions> = {\n config: Config\n fabric: Fabric\n Component: ReactGenerator<any>['Schema']\n generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>\n plugin: Plugin<TOptions>\n}\n\nexport async function buildSchema<TOptions extends PluginFactoryOptions>(\n schema: {\n name: string\n tree: Array<Schema>\n value: SchemaObject\n },\n { config, fabric, plugin, Component, generator }: BuildSchemaOptions<TOptions>,\n): Promise<void> {\n if (!Component) {\n return undefined\n }\n\n const { pluginManager, oas, mode } = generator.context\n\n const fabricChild = createReactFabric()\n await fabricChild.render(\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema} plugin={plugin} generator={generator} />\n </App>,\n )\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n","import type { KubbEvents, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { type AsyncEventEmitter, getUniqueName } from '@kubb/core/utils'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, OasTypes, OpenAPIV3, SchemaObject } from '@kubb/oas'\nimport { isDiscriminator, isNullable, isReference } from '@kubb/oas'\nimport type { Fabric } from '@kubb/react-fabric'\nimport pLimit from 'p-limit'\nimport { isDeepEqual, isNumber, uniqueWith } from 'remeda'\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\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 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 FakerMeta array\n * TODO TODO add docs\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> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {\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 const 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 && (shouldCache as any as boolean)\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 // 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-')) {\n const index = Number.parseInt(value.replace('#kubb-inline-', ''), 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 any,\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: transformers.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(Boolean)\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 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 any,\n format: schemaObject.format,\n },\n },\n ].filter(Boolean)\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(Boolean),\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: transformers.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: transformers.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(Boolean),\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 if (schemaObject.format) {\n if (schemaObject.type === 'integer' && (schemaObject.format === 'int32' || schemaObject.format === 'int64')) {\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.push({ 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((acc, propertyName) => {\n if (acc.properties?.[propertyName] && propertyName === schemaObject.discriminator.propertyName) {\n return {\n ...acc,\n properties: {\n ...acc.properties,\n [propertyName]: {\n ...((acc.properties[propertyName] as any) || {}),\n enum: schemaObject.discriminator.mapping ? Object.keys(schemaObject.discriminator.mapping) : undefined,\n },\n },\n }\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 // Increased parallelism for better performance\n // - generatorLimit increased from 1 to 3 to allow parallel generator processing\n // - schemaLimit increased from 10 to 30 to process more schemas concurrently\n const generatorLimit = pLimit(3)\n const schemaLimit = pLimit(30)\n\n const writeTasks = generators.map((generator) =>\n generatorLimit(async () => {\n const schemaTasks = schemaEntries.map(([name, schemaObject]) =>\n schemaLimit(async () => {\n const options = this.#getOptions(name)\n const tree = this.parse({ schema: schemaObject, name, parentName: null, rootName: name })\n\n if (generator.type === 'react') {\n await buildSchema(\n {\n name,\n value: schemaObject,\n tree,\n },\n {\n config: this.context.pluginManager.config,\n fabric: this.context.fabric,\n Component: generator.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 generator.schema?.({\n config: this.context.pluginManager.config,\n generator: this,\n schema: {\n name,\n value: 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"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;AAKA,IAAM,OAAN,MAAW;CACV;CACA;CAEA,YAAY,OAAO;AAClB,OAAK,QAAQ;;;AAIf,IAAqB,QAArB,MAA2B;CAC1B;CACA;CACA;CAEA,cAAc;AACb,OAAK,OAAO;;CAGb,QAAQ,OAAO;EACd,MAAM,OAAO,IAAI,KAAK,MAAM;AAE5B,MAAI,MAAKA,MAAO;AACf,SAAKC,KAAM,OAAO;AAClB,SAAKA,OAAQ;SACP;AACN,SAAKD,OAAQ;AACb,SAAKC,OAAQ;;AAGd,QAAKC;;CAGN,UAAU;EACT,MAAM,UAAU,MAAKF;AACrB,MAAI,CAAC,QACJ;AAGD,QAAKA,OAAQ,MAAKA,KAAM;AACxB,QAAKE;AAGL,MAAI,CAAC,MAAKF,KACT,OAAKC,OAAQ;AAGd,SAAO,QAAQ;;CAGhB,OAAO;AACN,MAAI,CAAC,MAAKD,KACT;AAGD,SAAO,MAAKA,KAAM;;CAMnB,QAAQ;AACP,QAAKA,OAAQ;AACb,QAAKC,OAAQ;AACb,QAAKC,OAAQ;;CAGd,IAAI,OAAO;AACV,SAAO,MAAKA;;CAGb,EAAG,OAAO,YAAY;EACrB,IAAI,UAAU,MAAKF;AAEnB,SAAO,SAAS;AACf,SAAM,QAAQ;AACd,aAAU,QAAQ;;;CAIpB,CAAE,QAAQ;AACT,SAAO,MAAKA,KACX,OAAM,KAAK,SAAS;;;;;;ACpFvB,SAAwB,OAAO,aAAa;AAC3C,qBAAoB,YAAY;CA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UAAU;KAAM,CAAC;AAEzF,QAAI,UAAU,SAAS,SAAS;AAC9B,WAAM,YACJ;MACE;MACA,OAAO;MACP;MACD,EACD;MACE,QAAQ,KAAK,QAAQ,cAAc;MACnC,QAAQ,KAAK,QAAQ;MACrB,WAAW,UAAU;MACrB,WAAW;MACX,QAAQ;OACN,GAAG,KAAK,QAAQ;OAChB,SAAS;QACP,GAAG,KAAK;QACR,GAAG;QACJ;OACF;MACF,CACF;AAED,YAAO,EAAE;;AAoBX,WAjBe,MAAM,UAAU,SAAS;KACtC,QAAQ,KAAK,QAAQ,cAAc;KACnC,WAAW;KACX,QAAQ;MACN;MACA,OAAO;MACP;MACD;KACD,QAAQ;MACN,GAAG,KAAK,QAAQ;MAChB,SAAS;OACP,GAAG,KAAK;OACR,GAAG;OACJ;MACF;KACF,CAAC,IAEe,EAAE;KACnB,CACH;AAGD,WADsB,MAAM,QAAQ,IAAI,YAAY,EAC/B,MAAM;IAC3B,CACH;AAID,UAFsB,MAAM,QAAQ,IAAI,WAAW,EAE9B,MAAM"}
|
|
@@ -584,7 +584,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
584
584
|
result: Result;
|
|
585
585
|
plugin: Plugin;
|
|
586
586
|
};
|
|
587
|
-
type Options
|
|
587
|
+
type Options = {
|
|
588
588
|
fabric: Fabric;
|
|
589
589
|
events: AsyncEventEmitter<KubbEvents>;
|
|
590
590
|
/**
|
|
@@ -602,8 +602,8 @@ type GetFileProps<TOptions = object> = {
|
|
|
602
602
|
declare class PluginManager {
|
|
603
603
|
#private;
|
|
604
604
|
readonly config: Config;
|
|
605
|
-
readonly options: Options
|
|
606
|
-
constructor(config: Config, options: Options
|
|
605
|
+
readonly options: Options;
|
|
606
|
+
constructor(config: Config, options: Options);
|
|
607
607
|
get events(): AsyncEventEmitter<KubbEvents>;
|
|
608
608
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
609
609
|
get plugins(): Array<Plugin>;
|
|
@@ -707,16 +707,21 @@ type Operation$1 = Operation;
|
|
|
707
707
|
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
708
708
|
//#endregion
|
|
709
709
|
//#region ../oas/src/Oas.d.ts
|
|
710
|
-
type
|
|
710
|
+
type OasOptions = {
|
|
711
711
|
contentType?: contentType;
|
|
712
712
|
discriminator?: 'strict' | 'inherit';
|
|
713
|
+
/**
|
|
714
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
715
|
+
* @default false
|
|
716
|
+
*/
|
|
717
|
+
collisionDetection?: boolean;
|
|
713
718
|
};
|
|
714
719
|
declare class Oas extends BaseOas {
|
|
715
720
|
#private;
|
|
716
721
|
document: Document;
|
|
717
722
|
constructor(document: Document);
|
|
718
|
-
setOptions(options:
|
|
719
|
-
get options():
|
|
723
|
+
setOptions(options: OasOptions): void;
|
|
724
|
+
get options(): OasOptions;
|
|
720
725
|
get<T = unknown>($ref: string): T | null;
|
|
721
726
|
getKey($ref: string): string | undefined;
|
|
722
727
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -727,6 +732,18 @@ declare class Oas extends BaseOas {
|
|
|
727
732
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
728
733
|
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
729
734
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
735
|
+
/**
|
|
736
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
737
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
738
|
+
*/
|
|
739
|
+
getSchemas(options?: {
|
|
740
|
+
contentType?: contentType;
|
|
741
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
742
|
+
collisionDetection?: boolean;
|
|
743
|
+
}): {
|
|
744
|
+
schemas: Record<string, SchemaObject$1>;
|
|
745
|
+
nameMapping: Map<string, string>;
|
|
746
|
+
};
|
|
730
747
|
}
|
|
731
748
|
//#endregion
|
|
732
749
|
//#region ../oas/src/utils.d.ts
|
|
@@ -1016,4 +1033,4 @@ type SchemaTree = {
|
|
|
1016
1033
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
1017
1034
|
//#endregion
|
|
1018
1035
|
export { Plugin as C, AsyncEventEmitter as D, UserPluginWithLifeCycle as E, KubbEvents as O, Output as S, ResolveNameParams as T, contentType as _, SchemaMapper as a, Config as b, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, BaseGenerator as k, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u, FileMetaBase as v, PluginFactoryOptions as w, Group as x, PluginManager as y };
|
|
1019
|
-
//# sourceMappingURL=SchemaMapper-
|
|
1036
|
+
//# sourceMappingURL=SchemaMapper-DI2vHHE0.d.ts.map
|
|
@@ -585,7 +585,7 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
|
|
|
585
585
|
result: Result;
|
|
586
586
|
plugin: Plugin;
|
|
587
587
|
};
|
|
588
|
-
type Options
|
|
588
|
+
type Options = {
|
|
589
589
|
fabric: Fabric;
|
|
590
590
|
events: AsyncEventEmitter<KubbEvents>;
|
|
591
591
|
/**
|
|
@@ -603,8 +603,8 @@ type GetFileProps<TOptions = object> = {
|
|
|
603
603
|
declare class PluginManager {
|
|
604
604
|
#private;
|
|
605
605
|
readonly config: Config;
|
|
606
|
-
readonly options: Options
|
|
607
|
-
constructor(config: Config, options: Options
|
|
606
|
+
readonly options: Options;
|
|
607
|
+
constructor(config: Config, options: Options);
|
|
608
608
|
get events(): AsyncEventEmitter<KubbEvents>;
|
|
609
609
|
getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
|
|
610
610
|
get plugins(): Array<Plugin>;
|
|
@@ -708,16 +708,21 @@ type Operation$1 = Operation;
|
|
|
708
708
|
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
709
709
|
//#endregion
|
|
710
710
|
//#region ../oas/src/Oas.d.ts
|
|
711
|
-
type
|
|
711
|
+
type OasOptions = {
|
|
712
712
|
contentType?: contentType;
|
|
713
713
|
discriminator?: 'strict' | 'inherit';
|
|
714
|
+
/**
|
|
715
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
716
|
+
* @default false
|
|
717
|
+
*/
|
|
718
|
+
collisionDetection?: boolean;
|
|
714
719
|
};
|
|
715
720
|
declare class Oas extends BaseOas {
|
|
716
721
|
#private;
|
|
717
722
|
document: Document;
|
|
718
723
|
constructor(document: Document);
|
|
719
|
-
setOptions(options:
|
|
720
|
-
get options():
|
|
724
|
+
setOptions(options: OasOptions): void;
|
|
725
|
+
get options(): OasOptions;
|
|
721
726
|
get<T = unknown>($ref: string): T | null;
|
|
722
727
|
getKey($ref: string): string | undefined;
|
|
723
728
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -728,6 +733,18 @@ declare class Oas extends BaseOas {
|
|
|
728
733
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
729
734
|
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
730
735
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
736
|
+
/**
|
|
737
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
738
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
739
|
+
*/
|
|
740
|
+
getSchemas(options?: {
|
|
741
|
+
contentType?: contentType;
|
|
742
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
743
|
+
collisionDetection?: boolean;
|
|
744
|
+
}): {
|
|
745
|
+
schemas: Record<string, SchemaObject$1>;
|
|
746
|
+
nameMapping: Map<string, string>;
|
|
747
|
+
};
|
|
731
748
|
}
|
|
732
749
|
//#endregion
|
|
733
750
|
//#region ../oas/src/utils.d.ts
|
|
@@ -1017,4 +1034,4 @@ type SchemaTree = {
|
|
|
1017
1034
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
1018
1035
|
//#endregion
|
|
1019
1036
|
export { __name as A, Plugin as C, AsyncEventEmitter as D, UserPluginWithLifeCycle as E, KubbEvents as O, Output as S, ResolveNameParams as T, contentType as _, SchemaMapper as a, Config as b, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, BaseGenerator as k, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u, FileMetaBase as v, PluginFactoryOptions as w, Group as x, PluginManager as y };
|
|
1020
|
-
//# sourceMappingURL=SchemaMapper-
|
|
1037
|
+
//# sourceMappingURL=SchemaMapper-DmB5NyNo.d.cts.map
|