@kubb/plugin-oas 4.7.3 → 4.8.0

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.
@@ -424,6 +424,7 @@ var SchemaGenerator = class SchemaGenerator extends BaseGenerator {
424
424
  ...schema,
425
425
  args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {
426
426
  const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value);
427
+ if (!arg) return;
427
428
  return {
428
429
  keyword: schemaKeywords.and,
429
430
  args: [arg, {
@@ -441,10 +442,33 @@ var SchemaGenerator = class SchemaGenerator extends BaseGenerator {
441
442
  } }
442
443
  }]
443
444
  };
444
- })
445
+ }).filter(Boolean)
445
446
  };
446
447
  }
447
448
  /**
449
+ * Checks if an allOf item reference would create a circular reference.
450
+ * This happens when a child schema extends a discriminator parent via allOf,
451
+ * and the parent has a oneOf/anyOf that references or maps to the child.
452
+ *
453
+ * Without oneOf/anyOf, the discriminator is just for documentation/validation
454
+ * purposes and doesn't create a TypeScript union type that would be circular.
455
+ */
456
+ #wouldCreateCircularReference(item, childSchemaName) {
457
+ if (!isReference(item) || !childSchemaName) return false;
458
+ const dereferencedSchema = this.context.oas.dereferenceWithRef(item);
459
+ if (dereferencedSchema && isDiscriminator(dereferencedSchema)) {
460
+ const parentOneOf = dereferencedSchema.oneOf || dereferencedSchema.anyOf;
461
+ if (!parentOneOf) return false;
462
+ const childRef = `#/components/schemas/${childSchemaName}`;
463
+ if (parentOneOf.some((oneOfItem) => {
464
+ return isReference(oneOfItem) && oneOfItem.$ref === childRef;
465
+ })) return true;
466
+ const mapping = dereferencedSchema.discriminator.mapping || {};
467
+ if (Object.values(mapping).some((value) => value === childRef)) return true;
468
+ }
469
+ return false;
470
+ }
471
+ /**
448
472
  * This is the very core of the OpenAPI to TS conversion - it takes a
449
473
  * schema and returns the appropriate type.
450
474
  */
@@ -606,6 +630,7 @@ var SchemaGenerator = class SchemaGenerator extends BaseGenerator {
606
630
  const and = {
607
631
  keyword: schemaKeywords.and,
608
632
  args: schemaObject.allOf.map((item) => {
633
+ if (this.#wouldCreateCircularReference(item, name)) return;
609
634
  return item && this.parse({
610
635
  schemaObject: item,
611
636
  name,
@@ -1004,4 +1029,4 @@ var SchemaGenerator = class SchemaGenerator extends BaseGenerator {
1004
1029
 
1005
1030
  //#endregion
1006
1031
  export { pLimit as a, buildSchema as i, buildOperation as n, buildOperations as r, SchemaGenerator as t };
1007
- //# sourceMappingURL=SchemaGenerator-DDv4R0ei.js.map
1032
+ //# sourceMappingURL=SchemaGenerator-BozZXCvj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaGenerator-BozZXCvj.js","names":["#head","#tail","#size","#getOptions","#parseSchemaObject","foundItems: SchemaKeywordMapper[T][]","foundItem: SchemaKeywordMapper[T] | undefined","mergedProperties: Record<string, Schema[]> | null","mergedAdditionalProps: Schema[]","newArgs: Schema[]","validationFunctions: Schema[]","additionalPropertiesSchemas: Schema[]","#getUnknownType","#usedAliasNames","#getRefAlias","#getParsedSchemaObject","#getEmptyType","baseItems: Schema[]","union: SchemaKeywordMapper['union']","#addDiscriminatorToSchema","and: Schema","#wouldCreateCircularReference","resolvedSchemas: SchemaObject[]","parsedItems: SchemaObject[]","name","min","max","#parseProperties"],"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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operations} generator={generator} plugin={plugin} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operation} plugin={plugin} generator={generator} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema} plugin={plugin} generator={generator} />\n </App>\n )\n })\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n","import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, 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 type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.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 /**\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'\n enumSuffix?: string\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(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schemaObject?: SchemaObject\n name?: string\n parentName?: string\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 // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\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)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\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\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 }: SchemaProps): 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(props: SchemaProps) {\n const options = this.#getOptions(props)\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(props: SchemaProps) {\n const options = this.#getOptions(props)\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({ schemaObject, name }: SchemaProps): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\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 = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schemaObject: propertySchema, name: propertyName, parentName: 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({ schemaObject, name }) }]\n : this.parse({ schemaObject: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\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 | undefined): 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 const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\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,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\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 const objectPropertySchema = SchemaGenerator.find(this.parse({ schemaObject: schemaObject }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {})\n .map(([key, value]) => {\n const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\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 | undefined): 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({ schemaObject: _schemaObject, name, parentName }: SchemaProps): Schema[] {\n const { schemaObject, version } = this.#getParsedSchemaObject(_schemaObject)\n\n const options = this.#getOptions({ schemaObject, name })\n const emptyType = this.#getEmptyType({ schemaObject, 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 const hasNull = (schemaObject.type as string[]).includes('null')\n\n if (hasNull && !nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\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 schemaObject: { ...schemaObject, type: item },\n name,\n parentName,\n })[0],\n )\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown))\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 will be ref\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: schemaWithoutOneOf, name, parentName })\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 .map((item) => {\n // Skip items that would create circular references\n if (this.#wouldCreateCircularReference(item, name)) {\n return undefined\n }\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: item, name, parentName })\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({ schemaObject: schemaWithoutAllOf, name, parentName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n if (options.enumSuffix === '') {\n this.context.pluginManager.logger.emit('info', 'EnumSuffix set to an empty string does not work')\n }\n\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].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({ schemaObject: item, name, parentName })[0]\n })\n .filter(Boolean),\n rest: this.parse({\n schemaObject: items,\n name,\n parentName,\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 precendence 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({ schemaObject: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName })\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) {\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 schemaObjectOverriden = 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 [\n ...this.#parseProperties({\n schemaObject: schemaObjectOverriden,\n name,\n }),\n ...baseItems,\n ]\n }\n\n return [...this.#parseProperties({ schemaObject, name }), ...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.pluginManager.logger.emit('warning', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n return [{ keyword: emptyType }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n const schemas = getSchemas({ oas, contentType, includes: include })\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(1)\n const schemaLimit = pLimit(10)\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({ name, schemaObject })\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,KA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,MAAM,UAAU,WAAW;GAAE;GAAK;GAAa,UAAU;GAAS,CAAC;EACnE,MAAM,gBAAgB,OAAO,QAAQ,QAAQ;EAE7C,MAAM,iBAAiB,OAAO,EAAE;EAChC,MAAM,cAAc,OAAO,GAAG;EAE9B,MAAM,aAAa,WAAW,KAAK,cACjC,eAAe,YAAY;GACzB,MAAM,cAAc,cAAc,KAAK,CAAC,MAAM,kBAC5C,YAAY,YAAY;IACtB,MAAM,UAAU,MAAKxB,WAAY,EAAE,MAAM,CAAC;IAC1C,MAAM,OAAO,KAAK,MAAM;KAAE;KAAM;KAAc,CAAC;AAE/C,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"}
@@ -426,6 +426,7 @@ var SchemaGenerator = class SchemaGenerator extends __kubb_core.BaseGenerator {
426
426
  ...schema,
427
427
  args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {
428
428
  const arg = schema.args.find((item) => require_SchemaMapper.isKeyword(item, require_SchemaMapper.schemaKeywords.ref) && item.args.$ref === value);
429
+ if (!arg) return;
429
430
  return {
430
431
  keyword: require_SchemaMapper.schemaKeywords.and,
431
432
  args: [arg, {
@@ -443,10 +444,33 @@ var SchemaGenerator = class SchemaGenerator extends __kubb_core.BaseGenerator {
443
444
  } }
444
445
  }]
445
446
  };
446
- })
447
+ }).filter(Boolean)
447
448
  };
448
449
  }
449
450
  /**
451
+ * Checks if an allOf item reference would create a circular reference.
452
+ * This happens when a child schema extends a discriminator parent via allOf,
453
+ * and the parent has a oneOf/anyOf that references or maps to the child.
454
+ *
455
+ * Without oneOf/anyOf, the discriminator is just for documentation/validation
456
+ * purposes and doesn't create a TypeScript union type that would be circular.
457
+ */
458
+ #wouldCreateCircularReference(item, childSchemaName) {
459
+ if (!(0, __kubb_oas.isReference)(item) || !childSchemaName) return false;
460
+ const dereferencedSchema = this.context.oas.dereferenceWithRef(item);
461
+ if (dereferencedSchema && (0, __kubb_oas.isDiscriminator)(dereferencedSchema)) {
462
+ const parentOneOf = dereferencedSchema.oneOf || dereferencedSchema.anyOf;
463
+ if (!parentOneOf) return false;
464
+ const childRef = `#/components/schemas/${childSchemaName}`;
465
+ if (parentOneOf.some((oneOfItem) => {
466
+ return (0, __kubb_oas.isReference)(oneOfItem) && oneOfItem.$ref === childRef;
467
+ })) return true;
468
+ const mapping = dereferencedSchema.discriminator.mapping || {};
469
+ if (Object.values(mapping).some((value) => value === childRef)) return true;
470
+ }
471
+ return false;
472
+ }
473
+ /**
450
474
  * This is the very core of the OpenAPI to TS conversion - it takes a
451
475
  * schema and returns the appropriate type.
452
476
  */
@@ -608,6 +632,7 @@ var SchemaGenerator = class SchemaGenerator extends __kubb_core.BaseGenerator {
608
632
  const and = {
609
633
  keyword: require_SchemaMapper.schemaKeywords.and,
610
634
  args: schemaObject.allOf.map((item) => {
635
+ if (this.#wouldCreateCircularReference(item, name)) return;
611
636
  return item && this.parse({
612
637
  schemaObject: item,
613
638
  name,
@@ -1035,4 +1060,4 @@ Object.defineProperty(exports, 'pLimit', {
1035
1060
  return pLimit;
1036
1061
  }
1037
1062
  });
1038
- //# sourceMappingURL=SchemaGenerator-Bg5O155W.cjs.map
1063
+ //# sourceMappingURL=SchemaGenerator-C0lubHZ5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaGenerator-C0lubHZ5.cjs","names":["#head","#tail","#size","App","BaseGenerator","#getOptions","#parseSchemaObject","isDeepEqual","foundItems: SchemaKeywordMapper[T][]","isKeyword","schemaKeywords","foundItem: SchemaKeywordMapper[T] | undefined","mergedProperties: Record<string, Schema[]> | null","mergedAdditionalProps: Schema[]","newArgs: Schema[]","validationFunctions: Schema[]","additionalPropertiesSchemas: Schema[]","#getUnknownType","#usedAliasNames","#getRefAlias","getSchemaFactory","#getParsedSchemaObject","#getEmptyType","baseItems: Schema[]","transformers","union: SchemaKeywordMapper['union']","#addDiscriminatorToSchema","and: Schema","#wouldCreateCircularReference","resolvedSchemas: SchemaObject[]","parsedItems: SchemaObject[]","name","min","max","#parseProperties","getSchemas"],"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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operations} generator={generator} plugin={plugin} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operation} plugin={plugin} generator={generator} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema} plugin={plugin} generator={generator} />\n </App>\n )\n })\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n","import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, 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 type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.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 /**\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'\n enumSuffix?: string\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(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schemaObject?: SchemaObject\n name?: string\n parentName?: string\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 // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\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)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\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\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 }: SchemaProps): 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(props: SchemaProps) {\n const options = this.#getOptions(props)\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(props: SchemaProps) {\n const options = this.#getOptions(props)\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({ schemaObject, name }: SchemaProps): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\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 = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schemaObject: propertySchema, name: propertyName, parentName: 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({ schemaObject, name }) }]\n : this.parse({ schemaObject: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\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 | undefined): 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 const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\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,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\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 const objectPropertySchema = SchemaGenerator.find(this.parse({ schemaObject: schemaObject }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {})\n .map(([key, value]) => {\n const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\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 | undefined): 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({ schemaObject: _schemaObject, name, parentName }: SchemaProps): Schema[] {\n const { schemaObject, version } = this.#getParsedSchemaObject(_schemaObject)\n\n const options = this.#getOptions({ schemaObject, name })\n const emptyType = this.#getEmptyType({ schemaObject, 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 const hasNull = (schemaObject.type as string[]).includes('null')\n\n if (hasNull && !nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\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 schemaObject: { ...schemaObject, type: item },\n name,\n parentName,\n })[0],\n )\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown))\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 will be ref\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: schemaWithoutOneOf, name, parentName })\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 .map((item) => {\n // Skip items that would create circular references\n if (this.#wouldCreateCircularReference(item, name)) {\n return undefined\n }\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: item, name, parentName })\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({ schemaObject: schemaWithoutAllOf, name, parentName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n if (options.enumSuffix === '') {\n this.context.pluginManager.logger.emit('info', 'EnumSuffix set to an empty string does not work')\n }\n\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].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({ schemaObject: item, name, parentName })[0]\n })\n .filter(Boolean),\n rest: this.parse({\n schemaObject: items,\n name,\n parentName,\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 precendence 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({ schemaObject: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName })\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) {\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 schemaObjectOverriden = 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 [\n ...this.#parseProperties({\n schemaObject: schemaObjectOverriden,\n name,\n }),\n ...baseItems,\n ]\n }\n\n return [...this.#parseProperties({ schemaObject, name }), ...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.pluginManager.logger.emit('warning', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n return [{ keyword: emptyType }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n const schemas = getSchemas({ oas, contentType, includes: include })\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(1)\n const schemaLimit = pLimit(10)\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({ name, schemaObject })\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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,gBAAgB,OAAO,QAAQ,QAAQ;EAE7C,MAAM,iBAAiB,OAAO,EAAE;EAChC,MAAM,cAAc,OAAO,GAAG;EAE9B,MAAM,aAAa,WAAW,KAAK,cACjC,eAAe,YAAY;GACzB,MAAM,cAAc,cAAc,KAAK,CAAC,MAAM,kBAC5C,YAAY,YAAY;IACtB,MAAM,UAAU,MAAK9B,WAAY,EAAE,MAAM,CAAC;IAC1C,MAAM,OAAO,KAAK,MAAM;KAAE;KAAM;KAAc,CAAC;AAE/C,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"}
package/dist/hooks.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_SchemaGenerator = require('./SchemaGenerator-Bg5O155W.cjs');
2
+ const require_SchemaGenerator = require('./SchemaGenerator-C0lubHZ5.cjs');
3
3
  const require_SchemaMapper = require('./SchemaMapper-BUV8vhg0.cjs');
4
4
  require('./getSchemas-BTCpbjet.cjs');
5
5
  let __kubb_react_fabric = require("@kubb/react-fabric");
package/dist/hooks.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as SchemaGenerator } from "./SchemaGenerator-DDv4R0ei.js";
1
+ import { t as SchemaGenerator } from "./SchemaGenerator-BozZXCvj.js";
2
2
  import { n as schemaKeywords } from "./SchemaMapper-GAIl5QsJ.js";
3
3
  import "./getSchemas-CyMcV4aw.js";
4
4
  import { useApp } from "@kubb/react-fabric";
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
2
  const require_generators = require('./generators--9_lTBjl.cjs');
3
- const require_SchemaGenerator = require('./SchemaGenerator-Bg5O155W.cjs');
3
+ const require_SchemaGenerator = require('./SchemaGenerator-C0lubHZ5.cjs');
4
4
  require('./getFooter-BWck5e2D.cjs');
5
5
  const require_SchemaMapper = require('./SchemaMapper-BUV8vhg0.cjs');
6
6
  require('./getSchemas-BTCpbjet.cjs');
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as createReactGenerator$1, r as createGenerator$1, t as jsonGenerator } from "./generators-BoBhVZzp.js";
2
- import { a as pLimit, i as buildSchema, n as buildOperation, r as buildOperations, t as SchemaGenerator } from "./SchemaGenerator-DDv4R0ei.js";
2
+ import { a as pLimit, i as buildSchema, n as buildOperation, r as buildOperations, t as SchemaGenerator } from "./SchemaGenerator-BozZXCvj.js";
3
3
  import "./getFooter-fhkUhUdk.js";
4
4
  import { n as schemaKeywords, t as isKeyword } from "./SchemaMapper-GAIl5QsJ.js";
5
5
  import "./getSchemas-CyMcV4aw.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-oas",
3
- "version": "4.7.3",
3
+ "version": "4.8.0",
4
4
  "description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -79,15 +79,15 @@
79
79
  }
80
80
  ],
81
81
  "dependencies": {
82
- "@kubb/react-fabric": "0.5.2",
82
+ "@kubb/react-fabric": "0.5.4",
83
83
  "@stoplight/yaml": "^4.3.0",
84
84
  "p-limit": "^7.2.0",
85
85
  "remeda": "^2.32.0",
86
- "@kubb/core": "4.7.3",
87
- "@kubb/oas": "4.7.3"
86
+ "@kubb/core": "4.8.0",
87
+ "@kubb/oas": "4.8.0"
88
88
  },
89
89
  "peerDependencies": {
90
- "@kubb/react-fabric": "0.5.2"
90
+ "@kubb/react-fabric": "0.5.4"
91
91
  },
92
92
  "engines": {
93
93
  "node": ">=20"
@@ -430,38 +430,86 @@ export class SchemaGenerator<
430
430
 
431
431
  return {
432
432
  ...schema,
433
- args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {
434
- const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)
435
- return {
436
- keyword: schemaKeywords.and,
437
- args: [
438
- arg,
439
- {
440
- keyword: schemaKeywords.object,
441
- args: {
442
- properties: {
443
- ...(objectPropertySchema?.args?.properties || {}),
444
- [discriminator.propertyName]: [
445
- {
446
- keyword: schemaKeywords.const,
447
- args: {
448
- name: key,
449
- format: 'string',
450
- value: key,
433
+ args: Object.entries(discriminator.mapping || {})
434
+ .map(([key, value]) => {
435
+ const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)
436
+ // Skip discriminator mappings that don't have a corresponding schema in the oneOf/anyOf
437
+ if (!arg) {
438
+ return undefined
439
+ }
440
+ return {
441
+ keyword: schemaKeywords.and,
442
+ args: [
443
+ arg,
444
+ {
445
+ keyword: schemaKeywords.object,
446
+ args: {
447
+ properties: {
448
+ ...(objectPropertySchema?.args?.properties || {}),
449
+ [discriminator.propertyName]: [
450
+ {
451
+ keyword: schemaKeywords.const,
452
+ args: {
453
+ name: key,
454
+ format: 'string',
455
+ value: key,
456
+ },
451
457
  },
452
- },
453
- //enum and literal will conflict
454
- ...(objectPropertySchema?.args?.properties[discriminator.propertyName] || []),
455
- ].filter((item) => !isKeyword(item, schemaKeywords.enum)),
458
+ //enum and literal will conflict
459
+ ...(objectPropertySchema?.args?.properties[discriminator.propertyName] || []),
460
+ ].filter((item) => !isKeyword(item, schemaKeywords.enum)),
461
+ },
456
462
  },
457
463
  },
458
- },
459
- ],
460
- }
461
- }),
464
+ ],
465
+ }
466
+ })
467
+ .filter(Boolean) as SchemaKeywordMapper['union']['args'],
462
468
  }
463
469
  }
464
470
 
471
+ /**
472
+ * Checks if an allOf item reference would create a circular reference.
473
+ * This happens when a child schema extends a discriminator parent via allOf,
474
+ * and the parent has a oneOf/anyOf that references or maps to the child.
475
+ *
476
+ * Without oneOf/anyOf, the discriminator is just for documentation/validation
477
+ * purposes and doesn't create a TypeScript union type that would be circular.
478
+ */
479
+ #wouldCreateCircularReference(item: unknown, childSchemaName: string | undefined): boolean {
480
+ if (!isReference(item) || !childSchemaName) {
481
+ return false
482
+ }
483
+
484
+ const dereferencedSchema = this.context.oas.dereferenceWithRef(item)
485
+
486
+ if (dereferencedSchema && isDiscriminator(dereferencedSchema)) {
487
+ // Only check for circular references if parent has oneOf/anyOf
488
+ // Without oneOf/anyOf, the discriminator doesn't create a union type
489
+ const parentOneOf = dereferencedSchema.oneOf || dereferencedSchema.anyOf
490
+ if (!parentOneOf) {
491
+ return false
492
+ }
493
+
494
+ const childRef = `#/components/schemas/${childSchemaName}`
495
+
496
+ const inOneOf = parentOneOf.some((oneOfItem) => {
497
+ return isReference(oneOfItem) && oneOfItem.$ref === childRef
498
+ })
499
+ if (inOneOf) {
500
+ return true
501
+ }
502
+
503
+ const mapping = dereferencedSchema.discriminator.mapping || {}
504
+ const inMapping = Object.values(mapping).some((value) => value === childRef)
505
+
506
+ if (inMapping) {
507
+ return true
508
+ }
509
+ }
510
+ return false
511
+ }
512
+
465
513
  /**
466
514
  * This is the very core of the OpenAPI to TS conversion - it takes a
467
515
  * schema and returns the appropriate type.
@@ -669,6 +717,10 @@ export class SchemaGenerator<
669
717
  keyword: schemaKeywords.and,
670
718
  args: schemaObject.allOf
671
719
  .map((item) => {
720
+ // Skip items that would create circular references
721
+ if (this.#wouldCreateCircularReference(item, name)) {
722
+ return undefined
723
+ }
672
724
  return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]
673
725
  })
674
726
  .filter(Boolean)
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaGenerator-Bg5O155W.cjs","names":["#head","#tail","#size","App","BaseGenerator","#getOptions","#parseSchemaObject","isDeepEqual","foundItems: SchemaKeywordMapper[T][]","isKeyword","schemaKeywords","foundItem: SchemaKeywordMapper[T] | undefined","mergedProperties: Record<string, Schema[]> | null","mergedAdditionalProps: Schema[]","newArgs: Schema[]","validationFunctions: Schema[]","additionalPropertiesSchemas: Schema[]","#getUnknownType","#usedAliasNames","#getRefAlias","getSchemaFactory","#getParsedSchemaObject","#getEmptyType","baseItems: Schema[]","transformers","union: SchemaKeywordMapper['union']","#addDiscriminatorToSchema","and: Schema","resolvedSchemas: SchemaObject[]","parsedItems: SchemaObject[]","name","min","max","#parseProperties","getSchemas"],"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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operations} generator={generator} plugin={plugin} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operation} plugin={plugin} generator={generator} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema} plugin={plugin} generator={generator} />\n </App>\n )\n })\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n","import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, 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 type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.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 /**\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'\n enumSuffix?: string\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(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schemaObject?: SchemaObject\n name?: string\n parentName?: string\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 // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\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)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\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\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 }: SchemaProps): 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(props: SchemaProps) {\n const options = this.#getOptions(props)\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(props: SchemaProps) {\n const options = this.#getOptions(props)\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({ schemaObject, name }: SchemaProps): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\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 = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schemaObject: propertySchema, name: propertyName, parentName: 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({ schemaObject, name }) }]\n : this.parse({ schemaObject: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\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 | undefined): 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 const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\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,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\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 const objectPropertySchema = SchemaGenerator.find(this.parse({ schemaObject: schemaObject }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {\n const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\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 }\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({ schemaObject: _schemaObject, name, parentName }: SchemaProps): Schema[] {\n const { schemaObject, version } = this.#getParsedSchemaObject(_schemaObject)\n\n const options = this.#getOptions({ schemaObject, name })\n const emptyType = this.#getEmptyType({ schemaObject, 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 const hasNull = (schemaObject.type as string[]).includes('null')\n\n if (hasNull && !nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\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 schemaObject: { ...schemaObject, type: item },\n name,\n parentName,\n })[0],\n )\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown))\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 will be ref\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: schemaWithoutOneOf, name, parentName })\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 .map((item) => {\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: item, name, parentName })\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({ schemaObject: schemaWithoutAllOf, name, parentName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n if (options.enumSuffix === '') {\n this.context.pluginManager.logger.emit('info', 'EnumSuffix set to an empty string does not work')\n }\n\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].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({ schemaObject: item, name, parentName })[0]\n })\n .filter(Boolean),\n rest: this.parse({\n schemaObject: items,\n name,\n parentName,\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 precendence 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({ schemaObject: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName })\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) {\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 schemaObjectOverriden = 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 [\n ...this.#parseProperties({\n schemaObject: schemaObjectOverriden,\n name,\n }),\n ...baseItems,\n ]\n }\n\n return [...this.#parseProperties({ schemaObject, name }), ...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.pluginManager.logger.emit('warning', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n return [{ keyword: emptyType }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n const schemas = getSchemas({ oas, contentType, includes: include })\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(1)\n const schemaLimit = pLimit(10)\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({ name, schemaObject })\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,I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cAAc,cAAc,KAAK,CAAC,MAAM,kBAC5C,YAAY,YAAY;IACtB,MAAM,UAAU,MAAK7B,WAAY,EAAE,MAAM,CAAC;IAC1C,MAAM,OAAO,KAAK,MAAM;KAAE;KAAM;KAAc,CAAC;AAE/C,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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SchemaGenerator-DDv4R0ei.js","names":["#head","#tail","#size","#getOptions","#parseSchemaObject","foundItems: SchemaKeywordMapper[T][]","foundItem: SchemaKeywordMapper[T] | undefined","mergedProperties: Record<string, Schema[]> | null","mergedAdditionalProps: Schema[]","newArgs: Schema[]","validationFunctions: Schema[]","additionalPropertiesSchemas: Schema[]","#getUnknownType","#usedAliasNames","#getRefAlias","#getParsedSchemaObject","#getEmptyType","baseItems: Schema[]","union: SchemaKeywordMapper['union']","#addDiscriminatorToSchema","and: Schema","resolvedSchemas: SchemaObject[]","parsedItems: SchemaObject[]","name","min","max","#parseProperties"],"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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operations={operations} generator={generator} plugin={plugin} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} operation={operation} plugin={plugin} generator={generator} />\n </App>\n )\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 return (\n <App meta={{ pluginManager, plugin, mode, oas }}>\n <Component config={config} schema={schema} plugin={plugin} generator={generator} />\n </App>\n )\n })\n\n await fabric.context.fileManager.upsert(...fabricChild.files)\n}\n","import type { Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from '@kubb/core'\nimport { BaseGenerator, type FileMetaBase } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { contentType, Oas, 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 type { Schema, SchemaKeywordMapper } from './SchemaMapper.ts'\nimport { isKeyword, schemaKeywords } from './SchemaMapper.ts'\nimport type { OperationSchema, Override, Refs } from './types.ts'\nimport { getSchemaFactory } from './utils/getSchemaFactory.ts'\nimport { getSchemas } from './utils/getSchemas.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 /**\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'\n enumSuffix?: string\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(propertName) and return FakerMeta array\n * TODO TODO add docs\n * @beta\n */\n schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined\n }\n}\n\nexport type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>\n\ntype SchemaProps = {\n schemaObject?: SchemaObject\n name?: string\n parentName?: string\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 // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\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)\n\n const defaultSchemas = this.#parseSchemaObject(props)\n const schemas = options.transformers?.schema?.(props, defaultSchemas) || defaultSchemas || []\n\n return uniqueWith(schemas, isDeepEqual)\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\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 }: SchemaProps): 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(props: SchemaProps) {\n const options = this.#getOptions(props)\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(props: SchemaProps) {\n const options = this.#getOptions(props)\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({ schemaObject, name }: SchemaProps): Schema[] {\n const properties = schemaObject?.properties || {}\n const additionalProperties = schemaObject?.additionalProperties\n const required = schemaObject?.required\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 = propertySchema.nullable ?? propertySchema['x-nullable'] ?? false\n\n validationFunctions.push(...this.parse({ schemaObject: propertySchema, name: propertyName, parentName: 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({ schemaObject, name }) }]\n : this.parse({ schemaObject: additionalProperties as SchemaObject, parentName: name })\n }\n\n return [\n {\n keyword: schemaKeywords.object,\n args: {\n properties: propertiesSchemas,\n additionalProperties: additionalPropertiesSchemas,\n },\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 | undefined): 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 const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({\n name: originalName,\n pluginKey: this.context.plugin.key,\n type: 'function',\n })\n\n const fileName = this.context.pluginManager.resolveName({\n name: originalName,\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,\n path: file.path,\n }\n\n return this.#getRefAlias(schemaObject, name)\n }\n\n #getParsedSchemaObject(schema?: SchemaObject) {\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 const objectPropertySchema = SchemaGenerator.find(this.parse({ schemaObject: schemaObject }), schemaKeywords.object)\n\n return {\n ...schema,\n args: Object.entries(discriminator.mapping || {}).map(([key, value]) => {\n const arg = schema.args.find((item) => isKeyword(item, schemaKeywords.ref) && item.args.$ref === value)\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 }\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({ schemaObject: _schemaObject, name, parentName }: SchemaProps): Schema[] {\n const { schemaObject, version } = this.#getParsedSchemaObject(_schemaObject)\n\n const options = this.#getOptions({ schemaObject, name })\n const emptyType = this.#getEmptyType({ schemaObject, 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 const hasNull = (schemaObject.type as string[]).includes('null')\n\n if (hasNull && !nullable) {\n baseItems.push({ keyword: schemaKeywords.nullable })\n }\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 schemaObject: { ...schemaObject, type: item },\n name,\n parentName,\n })[0],\n )\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown))\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 will be ref\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: schemaWithoutOneOf, name, parentName })\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 .map((item) => {\n return item && this.parse({ schemaObject: item as SchemaObject, name, parentName })[0]\n })\n .filter(Boolean)\n .filter((item) => !isKeyword(item, schemaKeywords.unknown)),\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({ schemaObject: item, name, parentName })\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({ schemaObject: schemaWithoutAllOf, name, parentName })]\n }\n\n return SchemaGenerator.combineObjects([and, ...baseItems])\n }\n\n if (schemaObject.enum) {\n if (options.enumSuffix === '') {\n this.context.pluginManager.logger.emit('info', 'EnumSuffix set to an empty string does not work')\n }\n\n const enumName = getUniqueName(pascalCase([parentName, name, options.enumSuffix].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({ schemaObject: item, name, parentName })[0]\n })\n .filter(Boolean),\n rest: this.parse({\n schemaObject: items,\n name,\n parentName,\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 precendence 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({ schemaObject: 'items' in schemaObject ? (schemaObject.items as SchemaObject) : [], name, parentName })\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) {\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 schemaObjectOverriden = 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 [\n ...this.#parseProperties({\n schemaObject: schemaObjectOverriden,\n name,\n }),\n ...baseItems,\n ]\n }\n\n return [...this.#parseProperties({ schemaObject, name }), ...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.pluginManager.logger.emit('warning', `Schema type '${schemaObject.type}' is not valid for schema ${parentName}.${name}`)\n }\n\n // 'string' | 'number' | 'integer' | 'boolean'\n return [{ keyword: type }, ...baseItems]\n }\n\n return [{ keyword: emptyType }]\n }\n\n async build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>> {\n const { oas, contentType, include } = this.context\n const schemas = getSchemas({ oas, contentType, includes: include })\n const schemaEntries = Object.entries(schemas)\n\n const generatorLimit = pLimit(1)\n const schemaLimit = pLimit(10)\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({ name, schemaObject })\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,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