@kubb/swagger-ts 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -168,14 +168,14 @@ function Query({
168
168
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: source });
169
169
  }
170
170
  Query.File = function({ mode }) {
171
- const { options } = _react.usePlugin.call(void 0, );
171
+ const plugin = _react.usePlugin.call(void 0, );
172
172
  const schemas = _hooks.useSchemas.call(void 0, );
173
173
  const pluginManager = _react.usePluginManager.call(void 0, );
174
174
  const oas = _hooks.useOas.call(void 0, );
175
175
  const file = _hooks.useOperationFile.call(void 0, );
176
176
  const factoryName = _hooks.useOperationName.call(void 0, { type: "type" });
177
177
  const operation = _hooks.useOperation.call(void 0, );
178
- const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.statusCodes);
178
+ const builder = new TypeBuilder(plugin.options, { oas, plugin, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.statusCodes);
179
179
  const { source, imports } = builder.build();
180
180
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Editor, { language: "typescript", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
181
181
  _react.File,
@@ -301,7 +301,7 @@ var definePlugin = _core.createPlugin.call(void 0, (options) => {
301
301
  const schemas = await swaggerPlugin.api.getSchemas();
302
302
  const root = _path2.default.resolve(this.config.root, this.config.output.path);
303
303
  const mode = _core.FileManager.getMode(_path2.default.resolve(root, output.path));
304
- const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager });
304
+ const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager });
305
305
  builder.add(
306
306
  Object.entries(schemas).map(([name, schema]) => ({ name, schema }))
307
307
  );
@@ -784,14 +784,14 @@ function Mutation({
784
784
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: source });
785
785
  }
786
786
  Mutation.File = function({ mode }) {
787
- const { options } = _react.usePlugin.call(void 0, );
787
+ const plugin = _react.usePlugin.call(void 0, );
788
788
  const schemas = _hooks.useSchemas.call(void 0, );
789
789
  const pluginManager = _react.usePluginManager.call(void 0, );
790
790
  const oas = _hooks.useOas.call(void 0, );
791
791
  const file = _hooks.useOperationFile.call(void 0, );
792
792
  const factoryName = _hooks.useOperationName.call(void 0, { type: "type" });
793
793
  const operation = _hooks.useOperation.call(void 0, );
794
- const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.request).add(schemas.statusCodes);
794
+ const builder = new TypeBuilder(plugin.options, { plugin, oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.request).add(schemas.statusCodes);
795
795
  const { source, imports } = builder.build();
796
796
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Editor, { language: "typescript", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
797
797
  _react.File,
@@ -820,4 +820,4 @@ Mutation.File = function({ mode }) {
820
820
 
821
821
 
822
822
  exports.Mutation = Mutation; exports.OasType = OasType; exports.Query = Query; exports.pluginName = pluginName; exports.pluginKey = pluginKey; exports.definePlugin = definePlugin;
823
- //# sourceMappingURL=chunk-A5NVLXY3.cjs.map
823
+ //# sourceMappingURL=chunk-75HLNTZM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Mutation.tsx","../src/TypeBuilder.ts","../src/TypeGenerator.ts","../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/Query.tsx"],"names":["transformers","print","factory","Editor","File","usePlugin","usePluginManager","useOas","useOperation","useOperationFile","useOperationName","useSchemas","Generator","pascalCase","keywordTypeNodes","Template","pluginKey","Fragment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BAAAe,MAACf,MAAK,QAAL,EACE;AAAA;AAAA,UACAmB,qBAAoB,aAAa,WAAW,OAAO;AAAA,WACtD;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Mutation({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nMutation.File = function({ mode }: FileProps): ReactNode {\n const plugin = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(plugin.options, { plugin, oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.request)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport { OasBuilder } from '@kubb/swagger'\nimport { refsSorter } from '@kubb/swagger/utils'\n\nimport { TypeGenerator } from './TypeGenerator.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ImportMeta } from '@kubb/swagger'\nimport type { PluginOptions } from './types.ts'\n\nexport class TypeBuilder extends OasBuilder<PluginOptions['resolvedOptions']> {\n build(name?: string): Required<Pick<KubbFile.File, 'imports' | 'source'>> {\n const importMeta: ImportMeta[] = []\n const codes: string[] = []\n\n const generated = this.items\n .filter((operationSchema) => (name ? operationSchema.name === name : true))\n .sort(transformers.nameSorter)\n .map((operationSchema) => {\n const generator = new TypeGenerator(this.options, this.context)\n const required = Array.isArray(operationSchema.schema?.required) ? !!operationSchema.schema.required.length : !!operationSchema.schema?.required\n\n const sources = generator.build({\n schema: operationSchema.schema,\n baseName: operationSchema.name,\n description: operationSchema.description,\n keysToOmit: operationSchema.keysToOmit,\n optional: !required && !!operationSchema.name.includes('Params'),\n })\n\n importMeta.push(...generator.imports)\n\n return {\n import: {\n refs: generator.refs,\n name: operationSchema.name,\n },\n sources,\n }\n })\n .sort(refsSorter)\n\n generated.forEach((item) => {\n codes.push(print(item.sources))\n })\n\n const imports: KubbFile.Import[] = importMeta.map((item) => {\n return {\n name: [item.ref.propertyName],\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n }\n })\n\n return {\n imports,\n source: transformers.combineCodes(codes),\n }\n }\n}\n","import { Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport * as factory from '@kubb/parser/factory'\nimport { keywordTypeNodes } from '@kubb/parser/factory'\nimport { getSchemaFactory, isReference } from '@kubb/swagger/utils'\n\nimport { pluginKey } from './plugin.ts'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { ImportMeta, Refs } from '@kubb/swagger'\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\n\n// based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n\ntype Context = {\n oas: Oas\n pluginManager: PluginManager\n}\n\nexport class TypeGenerator extends Generator<PluginOptions['resolvedOptions'], Context> {\n refs: Refs = {}\n imports: ImportMeta[] = []\n\n extraNodes: ts.Node[] = []\n\n aliases: ts.TypeAliasDeclaration[] = []\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n build({\n schema,\n optional,\n baseName,\n description,\n keysToOmit,\n }: {\n schema: SchemaObject\n baseName: string\n description?: string\n optional?: boolean\n keysToOmit?: string[]\n }): ts.Node[] {\n const nodes: ts.Node[] = []\n let type = this.getTypeFromSchema(schema, baseName)\n\n if (!type) {\n return this.extraNodes\n }\n\n if (optional) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'type' }),\n type: keysToOmit?.length ? factory.createOmitDeclaration({ keys: keysToOmit, type, nonNullable: true }) : type,\n })\n\n if (description) {\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [`@description ${transformers.trim(description)}`],\n }),\n )\n } else {\n nodes.push(node)\n }\n\n // filter out if the export name is the same as one that we already defined in extraNodes(see enum)\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !this.extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return [...this.extraNodes, ...filterdNodes]\n }\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n getTypeFromSchema(schema?: SchemaObject, name?: string): ts.TypeNode | null {\n const type = this.#getBaseTypeFromSchema(schema, name)\n\n if (!type) {\n return null\n }\n\n const nullable = (schema?.nullable ?? schema?.['x-nullable']) ?? false\n\n if (nullable) {\n return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n return type\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #getTypeFromProperties(baseSchema?: SchemaObject, baseName?: string): ts.TypeNode | null {\n const { optionalType } = this.options\n const properties = baseSchema?.properties || {}\n const required = baseSchema?.required\n const additionalProperties = baseSchema?.additionalProperties\n\n const members: Array<ts.TypeElement | null> = Object.keys(properties).map((name) => {\n const schema = properties[name] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required.includes(name) : !!required\n let type = this.getTypeFromSchema(schema, this.context.pluginManager.resolveName({ name: `${baseName || ''} ${name}`, pluginKey, type: 'type' }))\n\n if (!type) {\n return null\n }\n\n if (!isRequired && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n const propertySignature = factory.createPropertySignature({\n questionToken: ['questionToken', 'questionTokenAndUndefined'].includes(optionalType as string) && !isRequired,\n name,\n type: type as ts.TypeNode,\n readOnly: schema.readOnly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n schema.description ? `@description ${schema.description}` : undefined,\n schema.type ? `@type ${schema.type?.toString()}${isRequired ? '' : ' | undefined'} ${schema.format || ''}` : undefined,\n schema.example ? `@example ${schema.example as string}` : undefined,\n schema.deprecated ? `@deprecated` : undefined,\n schema.default !== undefined && typeof schema.default === 'string' ? `@default '${schema.default}'` : undefined,\n schema.default !== undefined && typeof schema.default !== 'string' ? `@default ${schema.default as string}` : undefined,\n ].filter(Boolean),\n })\n })\n if (additionalProperties) {\n const type = additionalProperties === true ? this.#unknownReturn : this.getTypeFromSchema(additionalProperties as SchemaObject)\n\n if (type) {\n members.push(factory.createIndexSignature(type))\n }\n }\n return factory.createTypeLiteralNode(members.filter(Boolean))\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject, _baseName?: string) {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n if (ref) {\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'type' })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n }\n\n const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'file' })\n const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey })\n\n this.imports.push({\n ref,\n path: path || '',\n isTypeOnly: true,\n })\n\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n #getParsedSchema(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\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 #getBaseTypeFromSchema(\n _schema: SchemaObject | undefined,\n baseName?: string,\n ): ts.TypeNode | null {\n const { schema, version } = this.#getParsedSchema(_schema)\n\n if (!schema) {\n return this.#unknownReturn\n }\n\n if (isReference(schema)) {\n return this.#getRefAlias(schema, baseName)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.oneOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutOneOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutOneOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n\n if (schema.anyOf) {\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.anyOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAnyOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined } as SchemaObject\n\n const and = factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes: schema.allOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAllOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAllOf, baseName), and].filter(Boolean),\n })\n }\n\n return and\n }\n\n /**\n * Enum will be defined outside the baseType(hints the baseName check)\n */\n if (schema.enum && baseName) {\n const enumName = getUniqueName(pascalCase([baseName, this.options.enumSuffix].join(' ')), this.options.usedEnumNames)\n\n let enums: [key: string, value: string | number][] = [...new Set(schema.enum)].map((key) => [key, key])\n\n const extensionEnums: Array<typeof enums> = ['x-enumNames', 'x-enum-varnames']\n .filter(extensionKey => extensionKey in schema)\n .map((extensionKey) =>\n [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((key, index) => [key, schema.enum?.[index] as string] as const)\n )\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n enums = extensionEnums[0]\n }\n\n this.extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumName),\n typeName: this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }),\n enums,\n type: this.options.enumType,\n }),\n )\n return factory.createTypeReferenceNode(this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }), undefined)\n }\n\n if (schema.enum) {\n return factory.createUnionDeclaration({\n nodes: schema.enum.map((name) => {\n return factory.createLiteralTypeNode(typeof name === 'number' ? factory.createNumericLiteral(name) : factory.createStringLiteral(`${name}`))\n }) as unknown as Array<ts.TypeNode>,\n })\n }\n\n if ('items' in schema) {\n // items -> array\n const node = this.getTypeFromSchema(schema.items as SchemaObject, baseName)\n if (node) {\n return factory.createArrayTypeNode(node)\n }\n }\n\n /**\n * OpenAPI 3.1\n * @link https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation\n */\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n\n return factory.createTupleDeclaration({\n nodes: prefixItems.map((item) => {\n // no baseType so we can fall back on an union when using enum\n return this.getTypeFromSchema(item, undefined)\n }) as Array<ts.TypeNode>,\n })\n }\n\n if (schema.properties || schema.additionalProperties) {\n // properties -> literal type\n return this.#getTypeFromProperties(schema as SchemaObject, baseName)\n }\n\n /**\n * validate \"const\" property as defined in JSON-Schema-Validation\n *\n * https://json-schema.org/draft/2020-12/json-schema-validation#name-const\n *\n * > 6.1.3. const\n * > The value of this keyword MAY be of any type, including null.\n * > Use of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\n * > An instance validates successfully against this keyword if its value is equal to the value of the keyword.\n */\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n if (typeof schema['const'] === 'string') {\n return factory.createLiteralTypeNode(factory.createStringLiteral(schema['const']))\n } else if (typeof schema['const'] === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(schema['const']))\n }\n } else {\n return keywordTypeNodes.null\n }\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // TODO remove hardcoded first type, second nullable\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type, nullable] = schema.type as Array<OpenAPIV3_1.NonArraySchemaObjectType>\n\n return factory.createUnionDeclaration({\n nodes: [\n this.getTypeFromSchema(\n {\n ...schema,\n type,\n } as SchemaObject,\n baseName,\n ),\n nullable ? factory.createLiteralTypeNode(factory.createNull()) : undefined,\n ].filter(Boolean),\n })\n }\n\n if (this.options.dateType === 'date' && ['date', 'date-time'].some((item) => item === schema.format)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Date'))\n }\n\n // string, boolean, null, number\n if (schema.type in factory.keywordTypeNodes) {\n return factory.keywordTypeNodes[schema.type as keyof typeof factory.keywordTypeNodes]\n }\n }\n\n if (schema.format === 'binary') {\n return factory.createTypeReferenceNode('Blob', [])\n }\n\n return this.#unknownReturn\n }\n\n get #unknownReturn() {\n if (this.options.unknownType === 'any') {\n return factory.keywordTypeNodes.any\n }\n\n return factory.keywordTypeNodes.unknown\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin, FileManager, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginName as swaggerPluginName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { TypeBuilder } from './TypeBuilder.ts'\n\nimport type { KubbFile, Plugin } from '@kubb/core'\nimport type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger'\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\nexport const pluginName = 'swagger-ts' satisfies PluginOptions['name']\nexport const pluginKey: PluginOptions['key'] = [pluginName] satisfies PluginOptions['key']\n\nexport const definePlugin = createPlugin<PluginOptions>((options) => {\n const {\n output = { path: 'types' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginName,\n options: {\n transformers,\n dateType,\n enumType,\n enumSuffix,\n optionalType,\n oasType,\n // keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n },\n pre: [swaggerPluginName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'file') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [swaggerPluginName])\n\n const oas = await swaggerPlugin.api.getOas()\n\n const schemas = await swaggerPlugin.api.getSchemas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager })\n\n builder.add(\n Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })),\n )\n\n if (mode === 'directory') {\n const mapFolderSchema = async ([name]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: 'file' })}.ts` as const\n const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key })\n const { source, imports } = builder.build(name)\n\n if (!resolvedPath) {\n return null\n }\n\n return this.addFile({\n path: resolvedPath,\n baseName,\n source,\n imports: imports.map(item => ({ ...item, root: resolvedPath })),\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const promises = Object.entries(schemas).map(mapFolderSchema)\n\n await Promise.all(promises)\n }\n\n if (mode === 'file') {\n const resolvedPath = this.resolvePath({ baseName: '', pluginKey: this.plugin.key })\n const { source } = builder.build()\n\n if (!resolvedPath) {\n return\n }\n\n await this.addFile({\n path: resolvedPath,\n baseName: output.path as KubbFile.BaseName,\n source,\n imports: [],\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const operationGenerator = new OperationGenerator(\n this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.api.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build()\n await this.addFile(...files)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n })\n },\n }\n})\n","import { createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { OasType } from './components/OasType.tsx'\nimport { Query } from './components/Query.tsx'\n\nimport type { AppContextProps } from '@kubb/react'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { FileMeta, PluginOptions } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginOptions['resolvedOptions'], PluginOptions> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n\n root.render(\n <Oas oas={oas} operations={operations} getSchemas={(...props) => this.getSchemas(...props)}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>,\n { meta: { pluginManager, plugin } },\n )\n\n return root.files\n }\n\n async get(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Query.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Mutation.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n}\n","import { Editor, File, Type, usePlugin } from '@kubb/react'\nimport { useFile } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({\n name,\n typeName,\n api,\n}: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({\n name,\n typeName,\n Template = defaultTemplates.default,\n}: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const { key: pluginKey } = usePlugin<PluginOptions>()\n const file = useFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Editor>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Query({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nQuery.File = function({ mode }: FileProps): ReactNode {\n const plugin = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(plugin.options, { oas, plugin, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n"]}
@@ -168,14 +168,14 @@ function Query({
168
168
  return /* @__PURE__ */ jsx2(Fragment2, { children: source });
169
169
  }
170
170
  Query.File = function({ mode }) {
171
- const { options } = usePlugin2();
171
+ const plugin = usePlugin2();
172
172
  const schemas = useSchemas();
173
173
  const pluginManager = usePluginManager();
174
174
  const oas = useOas2();
175
175
  const file = useOperationFile();
176
176
  const factoryName = useOperationName({ type: "type" });
177
177
  const operation = useOperation();
178
- const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.statusCodes);
178
+ const builder = new TypeBuilder(plugin.options, { oas, plugin, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.statusCodes);
179
179
  const { source, imports } = builder.build();
180
180
  return /* @__PURE__ */ jsx2(Editor2, { language: "typescript", children: /* @__PURE__ */ jsxs2(
181
181
  File2,
@@ -301,7 +301,7 @@ var definePlugin = createPlugin((options) => {
301
301
  const schemas = await swaggerPlugin.api.getSchemas();
302
302
  const root = path.resolve(this.config.root, this.config.output.path);
303
303
  const mode = FileManager.getMode(path.resolve(root, output.path));
304
- const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager });
304
+ const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager });
305
305
  builder.add(
306
306
  Object.entries(schemas).map(([name, schema]) => ({ name, schema }))
307
307
  );
@@ -784,14 +784,14 @@ function Mutation({
784
784
  return /* @__PURE__ */ jsx4(Fragment3, { children: source });
785
785
  }
786
786
  Mutation.File = function({ mode }) {
787
- const { options } = usePlugin3();
787
+ const plugin = usePlugin3();
788
788
  const schemas = useSchemas2();
789
789
  const pluginManager = usePluginManager2();
790
790
  const oas = useOas3();
791
791
  const file = useOperationFile2();
792
792
  const factoryName = useOperationName2({ type: "type" });
793
793
  const operation = useOperation2();
794
- const builder = new TypeBuilder(options, { oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.request).add(schemas.statusCodes);
794
+ const builder = new TypeBuilder(plugin.options, { plugin, oas, pluginManager }).add(schemas.pathParams).add(schemas.queryParams).add(schemas.headerParams).add(schemas.response).add(schemas.request).add(schemas.statusCodes);
795
795
  const { source, imports } = builder.build();
796
796
  return /* @__PURE__ */ jsx4(Editor3, { language: "typescript", children: /* @__PURE__ */ jsxs3(
797
797
  File3,
@@ -820,4 +820,4 @@ export {
820
820
  pluginKey,
821
821
  definePlugin
822
822
  };
823
- //# sourceMappingURL=chunk-RMYCGHXN.js.map
823
+ //# sourceMappingURL=chunk-EX53MIMI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Mutation.tsx","../src/TypeBuilder.ts","../src/TypeGenerator.ts","../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/Query.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Mutation({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nMutation.File = function({ mode }: FileProps): ReactNode {\n const plugin = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(plugin.options, { plugin, oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.request)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport { OasBuilder } from '@kubb/swagger'\nimport { refsSorter } from '@kubb/swagger/utils'\n\nimport { TypeGenerator } from './TypeGenerator.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ImportMeta } from '@kubb/swagger'\nimport type { PluginOptions } from './types.ts'\n\nexport class TypeBuilder extends OasBuilder<PluginOptions['resolvedOptions']> {\n build(name?: string): Required<Pick<KubbFile.File, 'imports' | 'source'>> {\n const importMeta: ImportMeta[] = []\n const codes: string[] = []\n\n const generated = this.items\n .filter((operationSchema) => (name ? operationSchema.name === name : true))\n .sort(transformers.nameSorter)\n .map((operationSchema) => {\n const generator = new TypeGenerator(this.options, this.context)\n const required = Array.isArray(operationSchema.schema?.required) ? !!operationSchema.schema.required.length : !!operationSchema.schema?.required\n\n const sources = generator.build({\n schema: operationSchema.schema,\n baseName: operationSchema.name,\n description: operationSchema.description,\n keysToOmit: operationSchema.keysToOmit,\n optional: !required && !!operationSchema.name.includes('Params'),\n })\n\n importMeta.push(...generator.imports)\n\n return {\n import: {\n refs: generator.refs,\n name: operationSchema.name,\n },\n sources,\n }\n })\n .sort(refsSorter)\n\n generated.forEach((item) => {\n codes.push(print(item.sources))\n })\n\n const imports: KubbFile.Import[] = importMeta.map((item) => {\n return {\n name: [item.ref.propertyName],\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n }\n })\n\n return {\n imports,\n source: transformers.combineCodes(codes),\n }\n }\n}\n","import { Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport * as factory from '@kubb/parser/factory'\nimport { keywordTypeNodes } from '@kubb/parser/factory'\nimport { getSchemaFactory, isReference } from '@kubb/swagger/utils'\n\nimport { pluginKey } from './plugin.ts'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { ImportMeta, Refs } from '@kubb/swagger'\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\n\n// based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n\ntype Context = {\n oas: Oas\n pluginManager: PluginManager\n}\n\nexport class TypeGenerator extends Generator<PluginOptions['resolvedOptions'], Context> {\n refs: Refs = {}\n imports: ImportMeta[] = []\n\n extraNodes: ts.Node[] = []\n\n aliases: ts.TypeAliasDeclaration[] = []\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n build({\n schema,\n optional,\n baseName,\n description,\n keysToOmit,\n }: {\n schema: SchemaObject\n baseName: string\n description?: string\n optional?: boolean\n keysToOmit?: string[]\n }): ts.Node[] {\n const nodes: ts.Node[] = []\n let type = this.getTypeFromSchema(schema, baseName)\n\n if (!type) {\n return this.extraNodes\n }\n\n if (optional) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'type' }),\n type: keysToOmit?.length ? factory.createOmitDeclaration({ keys: keysToOmit, type, nonNullable: true }) : type,\n })\n\n if (description) {\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [`@description ${transformers.trim(description)}`],\n }),\n )\n } else {\n nodes.push(node)\n }\n\n // filter out if the export name is the same as one that we already defined in extraNodes(see enum)\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !this.extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return [...this.extraNodes, ...filterdNodes]\n }\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n getTypeFromSchema(schema?: SchemaObject, name?: string): ts.TypeNode | null {\n const type = this.#getBaseTypeFromSchema(schema, name)\n\n if (!type) {\n return null\n }\n\n const nullable = (schema?.nullable ?? schema?.['x-nullable']) ?? false\n\n if (nullable) {\n return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n return type\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #getTypeFromProperties(baseSchema?: SchemaObject, baseName?: string): ts.TypeNode | null {\n const { optionalType } = this.options\n const properties = baseSchema?.properties || {}\n const required = baseSchema?.required\n const additionalProperties = baseSchema?.additionalProperties\n\n const members: Array<ts.TypeElement | null> = Object.keys(properties).map((name) => {\n const schema = properties[name] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required.includes(name) : !!required\n let type = this.getTypeFromSchema(schema, this.context.pluginManager.resolveName({ name: `${baseName || ''} ${name}`, pluginKey, type: 'type' }))\n\n if (!type) {\n return null\n }\n\n if (!isRequired && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n const propertySignature = factory.createPropertySignature({\n questionToken: ['questionToken', 'questionTokenAndUndefined'].includes(optionalType as string) && !isRequired,\n name,\n type: type as ts.TypeNode,\n readOnly: schema.readOnly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n schema.description ? `@description ${schema.description}` : undefined,\n schema.type ? `@type ${schema.type?.toString()}${isRequired ? '' : ' | undefined'} ${schema.format || ''}` : undefined,\n schema.example ? `@example ${schema.example as string}` : undefined,\n schema.deprecated ? `@deprecated` : undefined,\n schema.default !== undefined && typeof schema.default === 'string' ? `@default '${schema.default}'` : undefined,\n schema.default !== undefined && typeof schema.default !== 'string' ? `@default ${schema.default as string}` : undefined,\n ].filter(Boolean),\n })\n })\n if (additionalProperties) {\n const type = additionalProperties === true ? this.#unknownReturn : this.getTypeFromSchema(additionalProperties as SchemaObject)\n\n if (type) {\n members.push(factory.createIndexSignature(type))\n }\n }\n return factory.createTypeLiteralNode(members.filter(Boolean))\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject, _baseName?: string) {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n if (ref) {\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'type' })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n }\n\n const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'file' })\n const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey })\n\n this.imports.push({\n ref,\n path: path || '',\n isTypeOnly: true,\n })\n\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n #getParsedSchema(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\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 #getBaseTypeFromSchema(\n _schema: SchemaObject | undefined,\n baseName?: string,\n ): ts.TypeNode | null {\n const { schema, version } = this.#getParsedSchema(_schema)\n\n if (!schema) {\n return this.#unknownReturn\n }\n\n if (isReference(schema)) {\n return this.#getRefAlias(schema, baseName)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.oneOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutOneOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutOneOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n\n if (schema.anyOf) {\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.anyOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAnyOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined } as SchemaObject\n\n const and = factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes: schema.allOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAllOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAllOf, baseName), and].filter(Boolean),\n })\n }\n\n return and\n }\n\n /**\n * Enum will be defined outside the baseType(hints the baseName check)\n */\n if (schema.enum && baseName) {\n const enumName = getUniqueName(pascalCase([baseName, this.options.enumSuffix].join(' ')), this.options.usedEnumNames)\n\n let enums: [key: string, value: string | number][] = [...new Set(schema.enum)].map((key) => [key, key])\n\n const extensionEnums: Array<typeof enums> = ['x-enumNames', 'x-enum-varnames']\n .filter(extensionKey => extensionKey in schema)\n .map((extensionKey) =>\n [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((key, index) => [key, schema.enum?.[index] as string] as const)\n )\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n enums = extensionEnums[0]\n }\n\n this.extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumName),\n typeName: this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }),\n enums,\n type: this.options.enumType,\n }),\n )\n return factory.createTypeReferenceNode(this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }), undefined)\n }\n\n if (schema.enum) {\n return factory.createUnionDeclaration({\n nodes: schema.enum.map((name) => {\n return factory.createLiteralTypeNode(typeof name === 'number' ? factory.createNumericLiteral(name) : factory.createStringLiteral(`${name}`))\n }) as unknown as Array<ts.TypeNode>,\n })\n }\n\n if ('items' in schema) {\n // items -> array\n const node = this.getTypeFromSchema(schema.items as SchemaObject, baseName)\n if (node) {\n return factory.createArrayTypeNode(node)\n }\n }\n\n /**\n * OpenAPI 3.1\n * @link https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation\n */\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n\n return factory.createTupleDeclaration({\n nodes: prefixItems.map((item) => {\n // no baseType so we can fall back on an union when using enum\n return this.getTypeFromSchema(item, undefined)\n }) as Array<ts.TypeNode>,\n })\n }\n\n if (schema.properties || schema.additionalProperties) {\n // properties -> literal type\n return this.#getTypeFromProperties(schema as SchemaObject, baseName)\n }\n\n /**\n * validate \"const\" property as defined in JSON-Schema-Validation\n *\n * https://json-schema.org/draft/2020-12/json-schema-validation#name-const\n *\n * > 6.1.3. const\n * > The value of this keyword MAY be of any type, including null.\n * > Use of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\n * > An instance validates successfully against this keyword if its value is equal to the value of the keyword.\n */\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n if (typeof schema['const'] === 'string') {\n return factory.createLiteralTypeNode(factory.createStringLiteral(schema['const']))\n } else if (typeof schema['const'] === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(schema['const']))\n }\n } else {\n return keywordTypeNodes.null\n }\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // TODO remove hardcoded first type, second nullable\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type, nullable] = schema.type as Array<OpenAPIV3_1.NonArraySchemaObjectType>\n\n return factory.createUnionDeclaration({\n nodes: [\n this.getTypeFromSchema(\n {\n ...schema,\n type,\n } as SchemaObject,\n baseName,\n ),\n nullable ? factory.createLiteralTypeNode(factory.createNull()) : undefined,\n ].filter(Boolean),\n })\n }\n\n if (this.options.dateType === 'date' && ['date', 'date-time'].some((item) => item === schema.format)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Date'))\n }\n\n // string, boolean, null, number\n if (schema.type in factory.keywordTypeNodes) {\n return factory.keywordTypeNodes[schema.type as keyof typeof factory.keywordTypeNodes]\n }\n }\n\n if (schema.format === 'binary') {\n return factory.createTypeReferenceNode('Blob', [])\n }\n\n return this.#unknownReturn\n }\n\n get #unknownReturn() {\n if (this.options.unknownType === 'any') {\n return factory.keywordTypeNodes.any\n }\n\n return factory.keywordTypeNodes.unknown\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin, FileManager, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginName as swaggerPluginName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { TypeBuilder } from './TypeBuilder.ts'\n\nimport type { KubbFile, Plugin } from '@kubb/core'\nimport type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger'\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\nexport const pluginName = 'swagger-ts' satisfies PluginOptions['name']\nexport const pluginKey: PluginOptions['key'] = [pluginName] satisfies PluginOptions['key']\n\nexport const definePlugin = createPlugin<PluginOptions>((options) => {\n const {\n output = { path: 'types' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginName,\n options: {\n transformers,\n dateType,\n enumType,\n enumSuffix,\n optionalType,\n oasType,\n // keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n },\n pre: [swaggerPluginName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'file') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [swaggerPluginName])\n\n const oas = await swaggerPlugin.api.getOas()\n\n const schemas = await swaggerPlugin.api.getSchemas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager })\n\n builder.add(\n Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })),\n )\n\n if (mode === 'directory') {\n const mapFolderSchema = async ([name]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: 'file' })}.ts` as const\n const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key })\n const { source, imports } = builder.build(name)\n\n if (!resolvedPath) {\n return null\n }\n\n return this.addFile({\n path: resolvedPath,\n baseName,\n source,\n imports: imports.map(item => ({ ...item, root: resolvedPath })),\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const promises = Object.entries(schemas).map(mapFolderSchema)\n\n await Promise.all(promises)\n }\n\n if (mode === 'file') {\n const resolvedPath = this.resolvePath({ baseName: '', pluginKey: this.plugin.key })\n const { source } = builder.build()\n\n if (!resolvedPath) {\n return\n }\n\n await this.addFile({\n path: resolvedPath,\n baseName: output.path as KubbFile.BaseName,\n source,\n imports: [],\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const operationGenerator = new OperationGenerator(\n this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.api.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build()\n await this.addFile(...files)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n })\n },\n }\n})\n","import { createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { OasType } from './components/OasType.tsx'\nimport { Query } from './components/Query.tsx'\n\nimport type { AppContextProps } from '@kubb/react'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { FileMeta, PluginOptions } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginOptions['resolvedOptions'], PluginOptions> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n\n root.render(\n <Oas oas={oas} operations={operations} getSchemas={(...props) => this.getSchemas(...props)}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>,\n { meta: { pluginManager, plugin } },\n )\n\n return root.files\n }\n\n async get(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Query.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Mutation.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n}\n","import { Editor, File, Type, usePlugin } from '@kubb/react'\nimport { useFile } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({\n name,\n typeName,\n api,\n}: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({\n name,\n typeName,\n Template = defaultTemplates.default,\n}: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const { key: pluginKey } = usePlugin<PluginOptions>()\n const file = useFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Editor>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Query({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nQuery.File = function({ mode }: FileProps): ReactNode {\n const plugin = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(plugin.options, { oas, plugin, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item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AA5B,KAAkC;AAAA,QAC7D,CAAC;AAAA,QACD,gBAAAZ,MAACY,MAAK,QAAL,EACE;AAAA;AAAA,UACAX,qBAAoB,aAAa,WAAW,OAAO;AAAA,WACtD;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":["transformers","print","factory","Editor","File","usePlugin","usePluginManager","useOas","useOperation","useOperationFile","useOperationName","useSchemas","transformers","print","Generator","transformers","pascalCase","factory","keywordTypeNodes","Template","pluginKey","Editor","File","usePlugin","useOas","Fragment","jsx","jsxs","usePlugin","useOas","Editor","File","jsx","transformers","options","Generator","transformers","node","path","pascalCase","keywordTypeNodes","transformers","print","Fragment","jsx","jsxs","printCombinedSchema","transformers","print","usePlugin","useSchemas","usePluginManager","useOas","useOperationFile","useOperationName","useOperation","Editor","File"]}
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkA5NVLXY3cjs = require('./chunk-A5NVLXY3.cjs');
5
+ var _chunk75HLNTZMcjs = require('./chunk-75HLNTZM.cjs');
6
6
 
7
7
 
8
8
 
9
9
 
10
- exports.Mutation = _chunkA5NVLXY3cjs.Mutation; exports.OasType = _chunkA5NVLXY3cjs.OasType; exports.Query = _chunkA5NVLXY3cjs.Query;
10
+ exports.Mutation = _chunk75HLNTZMcjs.Mutation; exports.OasType = _chunk75HLNTZMcjs.OasType; exports.Query = _chunk75HLNTZMcjs.Query;
11
11
  //# sourceMappingURL=components.cjs.map
@@ -2,7 +2,7 @@ import {
2
2
  Mutation,
3
3
  OasType,
4
4
  Query
5
- } from "./chunk-RMYCGHXN.js";
5
+ } from "./chunk-EX53MIMI.js";
6
6
  export {
7
7
  Mutation,
8
8
  OasType,
package/dist/index.cjs CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkA5NVLXY3cjs = require('./chunk-A5NVLXY3.cjs');
5
+ var _chunk75HLNTZMcjs = require('./chunk-75HLNTZM.cjs');
6
6
 
7
7
  // src/index.ts
8
- var definePluginDefault = _chunkA5NVLXY3cjs.definePlugin;
8
+ var definePluginDefault = _chunk75HLNTZMcjs.definePlugin;
9
9
  var src_default = definePluginDefault;
10
10
 
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.default = src_default; exports.definePlugin = _chunkA5NVLXY3cjs.definePlugin; exports.pluginKey = _chunkA5NVLXY3cjs.pluginKey; exports.pluginName = _chunkA5NVLXY3cjs.pluginName;
15
+ exports.default = src_default; exports.definePlugin = _chunk75HLNTZMcjs.definePlugin; exports.pluginKey = _chunk75HLNTZMcjs.pluginKey; exports.pluginName = _chunk75HLNTZMcjs.pluginName;
16
16
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  definePlugin,
3
3
  pluginKey,
4
4
  pluginName
5
- } from "./chunk-RMYCGHXN.js";
5
+ } from "./chunk-EX53MIMI.js";
6
6
 
7
7
  // src/index.ts
8
8
  var definePluginDefault = definePlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/swagger-ts",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "Generator swagger-ts",
5
5
  "keywords": [
6
6
  "typescript",
@@ -59,14 +59,14 @@
59
59
  "hotscript": "^1.0.13",
60
60
  "json-schema-to-ts": "^3.0.1",
61
61
  "ts-toolbelt": "^9.6.0",
62
- "@kubb/core": "2.9.0",
63
- "@kubb/parser": "2.9.0",
64
- "@kubb/react": "2.9.0",
65
- "@kubb/swagger": "2.9.0",
66
- "@kubb/types": "2.9.0"
62
+ "@kubb/core": "2.9.1",
63
+ "@kubb/parser": "2.9.1",
64
+ "@kubb/react": "2.9.1",
65
+ "@kubb/swagger": "2.9.1",
66
+ "@kubb/types": "2.9.1"
67
67
  },
68
68
  "devDependencies": {
69
- "@types/react": "^18.2.64",
69
+ "@types/react": "^18.2.67",
70
70
  "eslint": "^8.57.0",
71
71
  "expect-type": "^0.17.3",
72
72
  "react": "^18.2.0",
@@ -76,7 +76,7 @@
76
76
  "@kubb/tsup-config": "1.1.8"
77
77
  },
78
78
  "peerDependencies": {
79
- "@kubb/react": "2.9.0"
79
+ "@kubb/react": "2.9.1"
80
80
  },
81
81
  "packageManager": "pnpm@8.3.0",
82
82
  "engines": {
@@ -103,7 +103,7 @@ type FileProps = {
103
103
  }
104
104
 
105
105
  Mutation.File = function({ mode }: FileProps): ReactNode {
106
- const { options } = usePlugin<PluginOptions>()
106
+ const plugin = usePlugin<PluginOptions>()
107
107
 
108
108
  const schemas = useSchemas()
109
109
  const pluginManager = usePluginManager()
@@ -112,7 +112,7 @@ Mutation.File = function({ mode }: FileProps): ReactNode {
112
112
  const factoryName = useOperationName({ type: 'type' })
113
113
  const operation = useOperation()
114
114
 
115
- const builder = new TypeBuilder(options, { oas, pluginManager })
115
+ const builder = new TypeBuilder(plugin.options, { plugin, oas, pluginManager })
116
116
  .add(schemas.pathParams)
117
117
  .add(schemas.queryParams)
118
118
  .add(schemas.headerParams)
@@ -104,7 +104,7 @@ type FileProps = {
104
104
  }
105
105
 
106
106
  Query.File = function({ mode }: FileProps): ReactNode {
107
- const { options } = usePlugin<PluginOptions>()
107
+ const plugin = usePlugin<PluginOptions>()
108
108
 
109
109
  const schemas = useSchemas()
110
110
  const pluginManager = usePluginManager()
@@ -113,7 +113,7 @@ Query.File = function({ mode }: FileProps): ReactNode {
113
113
  const factoryName = useOperationName({ type: 'type' })
114
114
  const operation = useOperation()
115
115
 
116
- const builder = new TypeBuilder(options, { oas, pluginManager })
116
+ const builder = new TypeBuilder(plugin.options, { oas, plugin, pluginManager })
117
117
  .add(schemas.pathParams)
118
118
  .add(schemas.queryParams)
119
119
  .add(schemas.headerParams)
package/src/plugin.ts CHANGED
@@ -90,7 +90,7 @@ export const definePlugin = createPlugin<PluginOptions>((options) => {
90
90
  const schemas = await swaggerPlugin.api.getSchemas()
91
91
  const root = path.resolve(this.config.root, this.config.output.path)
92
92
  const mode = FileManager.getMode(path.resolve(root, output.path))
93
- const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager })
93
+ const builder = new TypeBuilder(this.plugin.options, { oas, plugin: this.plugin, pluginManager: this.pluginManager })
94
94
 
95
95
  builder.add(
96
96
  Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })),
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Mutation.tsx","../src/TypeBuilder.ts","../src/TypeGenerator.ts","../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/Query.tsx"],"names":["transformers","print","factory","Editor","File","usePlugin","usePluginManager","useOas","useOperation","useOperationFile","useOperationName","useSchemas","Generator","pascalCase","keywordTypeNodes","Template","pluginKey","Fragment","jsx","jsxs","options","node","path","printCombinedSchema"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAOA,mBAAkB;AACzB,SAAS,SAAAC,cAAa;AACtB,YAAYC,cAAa;AACzB,SAAS,UAAAC,SAAQ,QAAAC,OAAM,aAAAC,YAAW,oBAAAC,yBAAwB;AAC1D,SAAS,UAAAC,SAAQ,gBAAAC,eAAc,oBAAAC,mBAAkB,oBAAAC,mBAAkB,cAAAC,mBAAkB;;;ACJrF,OAAOX,mBAAkB;AACzB,SAAS,SAAAC,cAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;;;ACH3B,SAAS,aAAAW,kBAAiB;AAC1B,OAAOZ,iBAAgB,cAAAa,mBAAkB;AACzC,SAAS,qBAAqB;AAC9B,YAAYX,cAAa;AACzB,SAAS,oBAAAY,yBAAwB;AACjC,SAAS,kBAAkB,mBAAmB;;;ACL9C,OAAO,UAAU;AAEjB,SAAS,cAAc,aAAa,qBAAqB;AACzD,SAAS,WAAW,kBAAkB;AACtC,SAAS,sBAAsB;AAC/B,SAAS,cAAc,yBAAyB;;;ACLhD,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB,iBAAiB;AAChD,SAAS,WAAW;;;ACFpB,SAAS,QAAQ,MAAM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,EACpB,IAAI,QAAQ,OAAO,EACnB,IAAI,QAAQ,WAAW;AAE1B,QAAM,EAAE,QAAQ,QAAQ,IAAI,QAAQ,MAAM;AAE1C,SACE,gBAAAU,KAACf,SAAA,EAAO,UAAS,cACf,0BAAAgB;AAAA,IAACf;AAAA,IAAA;AAAA,MACC,UAAU,KAAK;AAAA,MACf,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MAEV;AAAA,iBAAS,eAAe,QAAQ,IAAI,CAAC,MAAM,UAAU;AACpD,iBAAO,gBAAAc,KAACd,MAAK,QAAL,EAAwB,MAAM,KAAK,MAAO,GAAG,QAA5B,KAAkC;AAAA,QAC7D,CAAC;AAAA,QACD,gBAAAe,MAACf,MAAK,QAAL,EACE;AAAA;AAAA,UACAmB,qBAAoB,aAAa,WAAW,OAAO;AAAA,WACtD;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Mutation({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nMutation.File = function({ mode }: FileProps): ReactNode {\n const { options } = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(options, { oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.request)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport { OasBuilder } from '@kubb/swagger'\nimport { refsSorter } from '@kubb/swagger/utils'\n\nimport { TypeGenerator } from './TypeGenerator.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ImportMeta } from '@kubb/swagger'\nimport type { PluginOptions } from './types.ts'\n\nexport class TypeBuilder extends OasBuilder<PluginOptions['resolvedOptions']> {\n build(name?: string): Required<Pick<KubbFile.File, 'imports' | 'source'>> {\n const importMeta: ImportMeta[] = []\n const codes: string[] = []\n\n const generated = this.items\n .filter((operationSchema) => (name ? operationSchema.name === name : true))\n .sort(transformers.nameSorter)\n .map((operationSchema) => {\n const generator = new TypeGenerator(this.options, this.context)\n const required = Array.isArray(operationSchema.schema?.required) ? !!operationSchema.schema.required.length : !!operationSchema.schema?.required\n\n const sources = generator.build({\n schema: operationSchema.schema,\n baseName: operationSchema.name,\n description: operationSchema.description,\n keysToOmit: operationSchema.keysToOmit,\n optional: !required && !!operationSchema.name.includes('Params'),\n })\n\n importMeta.push(...generator.imports)\n\n return {\n import: {\n refs: generator.refs,\n name: operationSchema.name,\n },\n sources,\n }\n })\n .sort(refsSorter)\n\n generated.forEach((item) => {\n codes.push(print(item.sources))\n })\n\n const imports: KubbFile.Import[] = importMeta.map((item) => {\n return {\n name: [item.ref.propertyName],\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n }\n })\n\n return {\n imports,\n source: transformers.combineCodes(codes),\n }\n }\n}\n","import { Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport * as factory from '@kubb/parser/factory'\nimport { keywordTypeNodes } from '@kubb/parser/factory'\nimport { getSchemaFactory, isReference } from '@kubb/swagger/utils'\n\nimport { pluginKey } from './plugin.ts'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { ImportMeta, Refs } from '@kubb/swagger'\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\n\n// based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n\ntype Context = {\n oas: Oas\n pluginManager: PluginManager\n}\n\nexport class TypeGenerator extends Generator<PluginOptions['resolvedOptions'], Context> {\n refs: Refs = {}\n imports: ImportMeta[] = []\n\n extraNodes: ts.Node[] = []\n\n aliases: ts.TypeAliasDeclaration[] = []\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n build({\n schema,\n optional,\n baseName,\n description,\n keysToOmit,\n }: {\n schema: SchemaObject\n baseName: string\n description?: string\n optional?: boolean\n keysToOmit?: string[]\n }): ts.Node[] {\n const nodes: ts.Node[] = []\n let type = this.getTypeFromSchema(schema, baseName)\n\n if (!type) {\n return this.extraNodes\n }\n\n if (optional) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'type' }),\n type: keysToOmit?.length ? factory.createOmitDeclaration({ keys: keysToOmit, type, nonNullable: true }) : type,\n })\n\n if (description) {\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [`@description ${transformers.trim(description)}`],\n }),\n )\n } else {\n nodes.push(node)\n }\n\n // filter out if the export name is the same as one that we already defined in extraNodes(see enum)\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !this.extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return [...this.extraNodes, ...filterdNodes]\n }\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n getTypeFromSchema(schema?: SchemaObject, name?: string): ts.TypeNode | null {\n const type = this.#getBaseTypeFromSchema(schema, name)\n\n if (!type) {\n return null\n }\n\n const nullable = (schema?.nullable ?? schema?.['x-nullable']) ?? false\n\n if (nullable) {\n return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n return type\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #getTypeFromProperties(baseSchema?: SchemaObject, baseName?: string): ts.TypeNode | null {\n const { optionalType } = this.options\n const properties = baseSchema?.properties || {}\n const required = baseSchema?.required\n const additionalProperties = baseSchema?.additionalProperties\n\n const members: Array<ts.TypeElement | null> = Object.keys(properties).map((name) => {\n const schema = properties[name] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required.includes(name) : !!required\n let type = this.getTypeFromSchema(schema, this.context.pluginManager.resolveName({ name: `${baseName || ''} ${name}`, pluginKey, type: 'type' }))\n\n if (!type) {\n return null\n }\n\n if (!isRequired && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n const propertySignature = factory.createPropertySignature({\n questionToken: ['questionToken', 'questionTokenAndUndefined'].includes(optionalType as string) && !isRequired,\n name,\n type: type as ts.TypeNode,\n readOnly: schema.readOnly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n schema.description ? `@description ${schema.description}` : undefined,\n schema.type ? `@type ${schema.type?.toString()}${isRequired ? '' : ' | undefined'} ${schema.format || ''}` : undefined,\n schema.example ? `@example ${schema.example as string}` : undefined,\n schema.deprecated ? `@deprecated` : undefined,\n schema.default !== undefined && typeof schema.default === 'string' ? `@default '${schema.default}'` : undefined,\n schema.default !== undefined && typeof schema.default !== 'string' ? `@default ${schema.default as string}` : undefined,\n ].filter(Boolean),\n })\n })\n if (additionalProperties) {\n const type = additionalProperties === true ? this.#unknownReturn : this.getTypeFromSchema(additionalProperties as SchemaObject)\n\n if (type) {\n members.push(factory.createIndexSignature(type))\n }\n }\n return factory.createTypeLiteralNode(members.filter(Boolean))\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject, _baseName?: string) {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n if (ref) {\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'type' })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n }\n\n const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'file' })\n const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey })\n\n this.imports.push({\n ref,\n path: path || '',\n isTypeOnly: true,\n })\n\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n #getParsedSchema(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\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 #getBaseTypeFromSchema(\n _schema: SchemaObject | undefined,\n baseName?: string,\n ): ts.TypeNode | null {\n const { schema, version } = this.#getParsedSchema(_schema)\n\n if (!schema) {\n return this.#unknownReturn\n }\n\n if (isReference(schema)) {\n return this.#getRefAlias(schema, baseName)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.oneOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutOneOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutOneOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n\n if (schema.anyOf) {\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.anyOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAnyOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined } as SchemaObject\n\n const and = factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes: schema.allOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAllOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAllOf, baseName), and].filter(Boolean),\n })\n }\n\n return and\n }\n\n /**\n * Enum will be defined outside the baseType(hints the baseName check)\n */\n if (schema.enum && baseName) {\n const enumName = getUniqueName(pascalCase([baseName, this.options.enumSuffix].join(' ')), this.options.usedEnumNames)\n\n let enums: [key: string, value: string | number][] = [...new Set(schema.enum)].map((key) => [key, key])\n\n const extensionEnums: Array<typeof enums> = ['x-enumNames', 'x-enum-varnames']\n .filter(extensionKey => extensionKey in schema)\n .map((extensionKey) =>\n [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((key, index) => [key, schema.enum?.[index] as string] as const)\n )\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n enums = extensionEnums[0]\n }\n\n this.extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumName),\n typeName: this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }),\n enums,\n type: this.options.enumType,\n }),\n )\n return factory.createTypeReferenceNode(this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }), undefined)\n }\n\n if (schema.enum) {\n return factory.createUnionDeclaration({\n nodes: schema.enum.map((name) => {\n return factory.createLiteralTypeNode(typeof name === 'number' ? factory.createNumericLiteral(name) : factory.createStringLiteral(`${name}`))\n }) as unknown as Array<ts.TypeNode>,\n })\n }\n\n if ('items' in schema) {\n // items -> array\n const node = this.getTypeFromSchema(schema.items as SchemaObject, baseName)\n if (node) {\n return factory.createArrayTypeNode(node)\n }\n }\n\n /**\n * OpenAPI 3.1\n * @link https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation\n */\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n\n return factory.createTupleDeclaration({\n nodes: prefixItems.map((item) => {\n // no baseType so we can fall back on an union when using enum\n return this.getTypeFromSchema(item, undefined)\n }) as Array<ts.TypeNode>,\n })\n }\n\n if (schema.properties || schema.additionalProperties) {\n // properties -> literal type\n return this.#getTypeFromProperties(schema as SchemaObject, baseName)\n }\n\n /**\n * validate \"const\" property as defined in JSON-Schema-Validation\n *\n * https://json-schema.org/draft/2020-12/json-schema-validation#name-const\n *\n * > 6.1.3. const\n * > The value of this keyword MAY be of any type, including null.\n * > Use of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\n * > An instance validates successfully against this keyword if its value is equal to the value of the keyword.\n */\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n if (typeof schema['const'] === 'string') {\n return factory.createLiteralTypeNode(factory.createStringLiteral(schema['const']))\n } else if (typeof schema['const'] === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(schema['const']))\n }\n } else {\n return keywordTypeNodes.null\n }\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // TODO remove hardcoded first type, second nullable\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type, nullable] = schema.type as Array<OpenAPIV3_1.NonArraySchemaObjectType>\n\n return factory.createUnionDeclaration({\n nodes: [\n this.getTypeFromSchema(\n {\n ...schema,\n type,\n } as SchemaObject,\n baseName,\n ),\n nullable ? factory.createLiteralTypeNode(factory.createNull()) : undefined,\n ].filter(Boolean),\n })\n }\n\n if (this.options.dateType === 'date' && ['date', 'date-time'].some((item) => item === schema.format)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Date'))\n }\n\n // string, boolean, null, number\n if (schema.type in factory.keywordTypeNodes) {\n return factory.keywordTypeNodes[schema.type as keyof typeof factory.keywordTypeNodes]\n }\n }\n\n if (schema.format === 'binary') {\n return factory.createTypeReferenceNode('Blob', [])\n }\n\n return this.#unknownReturn\n }\n\n get #unknownReturn() {\n if (this.options.unknownType === 'any') {\n return factory.keywordTypeNodes.any\n }\n\n return factory.keywordTypeNodes.unknown\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin, FileManager, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginName as swaggerPluginName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { TypeBuilder } from './TypeBuilder.ts'\n\nimport type { KubbFile, Plugin } from '@kubb/core'\nimport type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger'\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\nexport const pluginName = 'swagger-ts' satisfies PluginOptions['name']\nexport const pluginKey: PluginOptions['key'] = [pluginName] satisfies PluginOptions['key']\n\nexport const definePlugin = createPlugin<PluginOptions>((options) => {\n const {\n output = { path: 'types' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginName,\n options: {\n transformers,\n dateType,\n enumType,\n enumSuffix,\n optionalType,\n oasType,\n // keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n },\n pre: [swaggerPluginName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'file') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [swaggerPluginName])\n\n const oas = await swaggerPlugin.api.getOas()\n\n const schemas = await swaggerPlugin.api.getSchemas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager })\n\n builder.add(\n Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })),\n )\n\n if (mode === 'directory') {\n const mapFolderSchema = async ([name]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: 'file' })}.ts` as const\n const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key })\n const { source, imports } = builder.build(name)\n\n if (!resolvedPath) {\n return null\n }\n\n return this.addFile({\n path: resolvedPath,\n baseName,\n source,\n imports: imports.map(item => ({ ...item, root: resolvedPath })),\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const promises = Object.entries(schemas).map(mapFolderSchema)\n\n await Promise.all(promises)\n }\n\n if (mode === 'file') {\n const resolvedPath = this.resolvePath({ baseName: '', pluginKey: this.plugin.key })\n const { source } = builder.build()\n\n if (!resolvedPath) {\n return\n }\n\n await this.addFile({\n path: resolvedPath,\n baseName: output.path as KubbFile.BaseName,\n source,\n imports: [],\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const operationGenerator = new OperationGenerator(\n this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.api.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build()\n await this.addFile(...files)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n })\n },\n }\n})\n","import { createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { OasType } from './components/OasType.tsx'\nimport { Query } from './components/Query.tsx'\n\nimport type { AppContextProps } from '@kubb/react'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { FileMeta, PluginOptions } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginOptions['resolvedOptions'], PluginOptions> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n\n root.render(\n <Oas oas={oas} operations={operations} getSchemas={(...props) => this.getSchemas(...props)}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>,\n { meta: { pluginManager, plugin } },\n )\n\n return root.files\n }\n\n async get(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Query.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Mutation.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n}\n","import { Editor, File, Type, usePlugin } from '@kubb/react'\nimport { useFile } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({\n name,\n typeName,\n api,\n}: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({\n name,\n typeName,\n Template = defaultTemplates.default,\n}: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const { key: pluginKey } = usePlugin<PluginOptions>()\n const file = useFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Editor>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Query({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nQuery.File = function({ mode }: FileProps): ReactNode {\n const { options } = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(options, { oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Mutation.tsx","../src/TypeBuilder.ts","../src/TypeGenerator.ts","../src/plugin.ts","../src/OperationGenerator.tsx","../src/components/OasType.tsx","../src/components/Query.tsx"],"sourcesContent":["import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Mutation({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nMutation.File = function({ mode }: FileProps): ReactNode {\n const { options } = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(options, { oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.request)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName, operation, schemas)}\n </File.Source>\n </File>\n </Editor>\n )\n}\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport { OasBuilder } from '@kubb/swagger'\nimport { refsSorter } from '@kubb/swagger/utils'\n\nimport { TypeGenerator } from './TypeGenerator.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ImportMeta } from '@kubb/swagger'\nimport type { PluginOptions } from './types.ts'\n\nexport class TypeBuilder extends OasBuilder<PluginOptions['resolvedOptions']> {\n build(name?: string): Required<Pick<KubbFile.File, 'imports' | 'source'>> {\n const importMeta: ImportMeta[] = []\n const codes: string[] = []\n\n const generated = this.items\n .filter((operationSchema) => (name ? operationSchema.name === name : true))\n .sort(transformers.nameSorter)\n .map((operationSchema) => {\n const generator = new TypeGenerator(this.options, this.context)\n const required = Array.isArray(operationSchema.schema?.required) ? !!operationSchema.schema.required.length : !!operationSchema.schema?.required\n\n const sources = generator.build({\n schema: operationSchema.schema,\n baseName: operationSchema.name,\n description: operationSchema.description,\n keysToOmit: operationSchema.keysToOmit,\n optional: !required && !!operationSchema.name.includes('Params'),\n })\n\n importMeta.push(...generator.imports)\n\n return {\n import: {\n refs: generator.refs,\n name: operationSchema.name,\n },\n sources,\n }\n })\n .sort(refsSorter)\n\n generated.forEach((item) => {\n codes.push(print(item.sources))\n })\n\n const imports: KubbFile.Import[] = importMeta.map((item) => {\n return {\n name: [item.ref.propertyName],\n path: item.path,\n isTypeOnly: item.isTypeOnly,\n }\n })\n\n return {\n imports,\n source: transformers.combineCodes(codes),\n }\n }\n}\n","import { Generator } from '@kubb/core'\nimport transformers, { pascalCase } from '@kubb/core/transformers'\nimport { getUniqueName } from '@kubb/core/utils'\nimport * as factory from '@kubb/parser/factory'\nimport { keywordTypeNodes } from '@kubb/parser/factory'\nimport { getSchemaFactory, isReference } from '@kubb/swagger/utils'\n\nimport { pluginKey } from './plugin.ts'\n\nimport type { PluginManager } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { ImportMeta, Refs } from '@kubb/swagger'\nimport type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\n\n// based on https://github.com/cellular/oazapfts/blob/7ba226ebb15374e8483cc53e7532f1663179a22c/src/codegen/generate.ts#L398\n\ntype Context = {\n oas: Oas\n pluginManager: PluginManager\n}\n\nexport class TypeGenerator extends Generator<PluginOptions['resolvedOptions'], Context> {\n refs: Refs = {}\n imports: ImportMeta[] = []\n\n extraNodes: ts.Node[] = []\n\n aliases: ts.TypeAliasDeclaration[] = []\n\n // Keep track of already used type aliases\n #usedAliasNames: Record<string, number> = {}\n\n build({\n schema,\n optional,\n baseName,\n description,\n keysToOmit,\n }: {\n schema: SchemaObject\n baseName: string\n description?: string\n optional?: boolean\n keysToOmit?: string[]\n }): ts.Node[] {\n const nodes: ts.Node[] = []\n let type = this.getTypeFromSchema(schema, baseName)\n\n if (!type) {\n return this.extraNodes\n }\n\n if (optional) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] }) as ts.TypeNode\n }\n\n const node = factory.createTypeAliasDeclaration({\n modifiers: [factory.modifiers.export],\n name: this.context.pluginManager.resolveName({ name: baseName, pluginKey, type: 'type' }),\n type: keysToOmit?.length ? factory.createOmitDeclaration({ keys: keysToOmit, type, nonNullable: true }) : type,\n })\n\n if (description) {\n nodes.push(\n factory.appendJSDocToNode({\n node,\n comments: [`@description ${transformers.trim(description)}`],\n }),\n )\n } else {\n nodes.push(node)\n }\n\n // filter out if the export name is the same as one that we already defined in extraNodes(see enum)\n const filterdNodes = nodes.filter(\n (node: ts.Node) =>\n !this.extraNodes.some(\n (extraNode: ts.Node) => (extraNode as ts.TypeAliasDeclaration)?.name?.escapedText === (node as ts.TypeAliasDeclaration)?.name?.escapedText,\n ),\n )\n\n return [...this.extraNodes, ...filterdNodes]\n }\n\n /**\n * Creates a type node from a given schema.\n * Delegates to getBaseTypeFromSchema internally and\n * optionally adds a union with null.\n */\n getTypeFromSchema(schema?: SchemaObject, name?: string): ts.TypeNode | null {\n const type = this.#getBaseTypeFromSchema(schema, name)\n\n if (!type) {\n return null\n }\n\n const nullable = (schema?.nullable ?? schema?.['x-nullable']) ?? false\n\n if (nullable) {\n return factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.null] })\n }\n\n return type\n }\n\n /**\n * Recursively creates a type literal with the given props.\n */\n #getTypeFromProperties(baseSchema?: SchemaObject, baseName?: string): ts.TypeNode | null {\n const { optionalType } = this.options\n const properties = baseSchema?.properties || {}\n const required = baseSchema?.required\n const additionalProperties = baseSchema?.additionalProperties\n\n const members: Array<ts.TypeElement | null> = Object.keys(properties).map((name) => {\n const schema = properties[name] as SchemaObject\n\n const isRequired = Array.isArray(required) ? required.includes(name) : !!required\n let type = this.getTypeFromSchema(schema, this.context.pluginManager.resolveName({ name: `${baseName || ''} ${name}`, pluginKey, type: 'type' }))\n\n if (!type) {\n return null\n }\n\n if (!isRequired && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({ nodes: [type, factory.keywordTypeNodes.undefined] })\n }\n const propertySignature = factory.createPropertySignature({\n questionToken: ['questionToken', 'questionTokenAndUndefined'].includes(optionalType as string) && !isRequired,\n name,\n type: type as ts.TypeNode,\n readOnly: schema.readOnly,\n })\n\n return factory.appendJSDocToNode({\n node: propertySignature,\n comments: [\n schema.description ? `@description ${schema.description}` : undefined,\n schema.type ? `@type ${schema.type?.toString()}${isRequired ? '' : ' | undefined'} ${schema.format || ''}` : undefined,\n schema.example ? `@example ${schema.example as string}` : undefined,\n schema.deprecated ? `@deprecated` : undefined,\n schema.default !== undefined && typeof schema.default === 'string' ? `@default '${schema.default}'` : undefined,\n schema.default !== undefined && typeof schema.default !== 'string' ? `@default ${schema.default as string}` : undefined,\n ].filter(Boolean),\n })\n })\n if (additionalProperties) {\n const type = additionalProperties === true ? this.#unknownReturn : this.getTypeFromSchema(additionalProperties as SchemaObject)\n\n if (type) {\n members.push(factory.createIndexSignature(type))\n }\n }\n return factory.createTypeLiteralNode(members.filter(Boolean))\n }\n\n /**\n * Create a type alias for the schema referenced by the given ReferenceObject\n */\n #getRefAlias(obj: OpenAPIV3.ReferenceObject, _baseName?: string) {\n const { $ref } = obj\n let ref = this.refs[$ref]\n\n if (ref) {\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n const originalName = getUniqueName($ref.replace(/.+\\//, ''), this.#usedAliasNames)\n const propertyName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'type' })\n\n ref = this.refs[$ref] = {\n propertyName,\n originalName,\n }\n\n const fileName = this.context.pluginManager.resolveName({ name: originalName, pluginKey, type: 'file' })\n const path = this.context.pluginManager.resolvePath({ baseName: fileName, pluginKey })\n\n this.imports.push({\n ref,\n path: path || '',\n isTypeOnly: true,\n })\n\n return factory.createTypeReferenceNode(ref.propertyName, undefined)\n }\n\n #getParsedSchema(schema?: SchemaObject) {\n const parsedSchema = getSchemaFactory(this.context.oas)(schema)\n return parsedSchema\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 #getBaseTypeFromSchema(\n _schema: SchemaObject | undefined,\n baseName?: string,\n ): ts.TypeNode | null {\n const { schema, version } = this.#getParsedSchema(_schema)\n\n if (!schema) {\n return this.#unknownReturn\n }\n\n if (isReference(schema)) {\n return this.#getRefAlias(schema, baseName)\n }\n\n if (schema.oneOf) {\n // union\n const schemaWithoutOneOf = { ...schema, oneOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.oneOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutOneOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutOneOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n\n if (schema.anyOf) {\n const schemaWithoutAnyOf = { ...schema, anyOf: undefined } as SchemaObject\n\n const union = factory.createUnionDeclaration({\n withParentheses: true,\n nodes: schema.anyOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAnyOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAnyOf, baseName), union].filter(Boolean),\n })\n }\n\n return union\n }\n if (schema.allOf) {\n // intersection/add\n const schemaWithoutAllOf = { ...schema, allOf: undefined } as SchemaObject\n\n const and = factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes: schema.allOf\n .map((item) => {\n return item && this.getTypeFromSchema(item as SchemaObject)\n })\n .filter((item) => {\n return item && item !== this.#unknownReturn\n }) as Array<ts.TypeNode>,\n })\n\n if (schemaWithoutAllOf.properties) {\n return factory.createIntersectionDeclaration({\n nodes: [this.getTypeFromSchema(schemaWithoutAllOf, baseName), and].filter(Boolean),\n })\n }\n\n return and\n }\n\n /**\n * Enum will be defined outside the baseType(hints the baseName check)\n */\n if (schema.enum && baseName) {\n const enumName = getUniqueName(pascalCase([baseName, this.options.enumSuffix].join(' ')), this.options.usedEnumNames)\n\n let enums: [key: string, value: string | number][] = [...new Set(schema.enum)].map((key) => [key, key])\n\n const extensionEnums: Array<typeof enums> = ['x-enumNames', 'x-enum-varnames']\n .filter(extensionKey => extensionKey in schema)\n .map((extensionKey) =>\n [...new Set(schema[extensionKey as keyof typeof schema] as string[])].map((key, index) => [key, schema.enum?.[index] as string] as const)\n )\n\n if (extensionEnums.length > 0 && extensionEnums[0]) {\n enums = extensionEnums[0]\n }\n\n this.extraNodes.push(\n ...factory.createEnumDeclaration({\n name: transformers.camelCase(enumName),\n typeName: this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }),\n enums,\n type: this.options.enumType,\n }),\n )\n return factory.createTypeReferenceNode(this.context.pluginManager.resolveName({ name: enumName, pluginKey, type: 'type' }), undefined)\n }\n\n if (schema.enum) {\n return factory.createUnionDeclaration({\n nodes: schema.enum.map((name) => {\n return factory.createLiteralTypeNode(typeof name === 'number' ? factory.createNumericLiteral(name) : factory.createStringLiteral(`${name}`))\n }) as unknown as Array<ts.TypeNode>,\n })\n }\n\n if ('items' in schema) {\n // items -> array\n const node = this.getTypeFromSchema(schema.items as SchemaObject, baseName)\n if (node) {\n return factory.createArrayTypeNode(node)\n }\n }\n\n /**\n * OpenAPI 3.1\n * @link https://json-schema.org/understanding-json-schema/reference/array.html#tuple-validation\n */\n\n if ('prefixItems' in schema) {\n const prefixItems = schema.prefixItems as SchemaObject[]\n\n return factory.createTupleDeclaration({\n nodes: prefixItems.map((item) => {\n // no baseType so we can fall back on an union when using enum\n return this.getTypeFromSchema(item, undefined)\n }) as Array<ts.TypeNode>,\n })\n }\n\n if (schema.properties || schema.additionalProperties) {\n // properties -> literal type\n return this.#getTypeFromProperties(schema as SchemaObject, baseName)\n }\n\n /**\n * validate \"const\" property as defined in JSON-Schema-Validation\n *\n * https://json-schema.org/draft/2020-12/json-schema-validation#name-const\n *\n * > 6.1.3. const\n * > The value of this keyword MAY be of any type, including null.\n * > Use of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\n * > An instance validates successfully against this keyword if its value is equal to the value of the keyword.\n */\n if (version === '3.1' && 'const' in schema) {\n // const keyword takes precendence over the actual type.\n if (schema['const']) {\n if (typeof schema['const'] === 'string') {\n return factory.createLiteralTypeNode(factory.createStringLiteral(schema['const']))\n } else if (typeof schema['const'] === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(schema['const']))\n }\n } else {\n return keywordTypeNodes.null\n }\n }\n\n if (schema.type) {\n if (Array.isArray(schema.type)) {\n // TODO remove hardcoded first type, second nullable\n // OPENAPI v3.1.0: https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0\n const [type, nullable] = schema.type as Array<OpenAPIV3_1.NonArraySchemaObjectType>\n\n return factory.createUnionDeclaration({\n nodes: [\n this.getTypeFromSchema(\n {\n ...schema,\n type,\n } as SchemaObject,\n baseName,\n ),\n nullable ? factory.createLiteralTypeNode(factory.createNull()) : undefined,\n ].filter(Boolean),\n })\n }\n\n if (this.options.dateType === 'date' && ['date', 'date-time'].some((item) => item === schema.format)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Date'))\n }\n\n // string, boolean, null, number\n if (schema.type in factory.keywordTypeNodes) {\n return factory.keywordTypeNodes[schema.type as keyof typeof factory.keywordTypeNodes]\n }\n }\n\n if (schema.format === 'binary') {\n return factory.createTypeReferenceNode('Blob', [])\n }\n\n return this.#unknownReturn\n }\n\n get #unknownReturn() {\n if (this.options.unknownType === 'any') {\n return factory.keywordTypeNodes.any\n }\n\n return factory.keywordTypeNodes.unknown\n }\n}\n","import path from 'node:path'\n\nimport { createPlugin, FileManager, PluginManager } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { pluginName as swaggerPluginName } from '@kubb/swagger'\n\nimport { OperationGenerator } from './OperationGenerator.tsx'\nimport { TypeBuilder } from './TypeBuilder.ts'\n\nimport type { KubbFile, Plugin } from '@kubb/core'\nimport type { PluginOptions as SwaggerPluginOptions } from '@kubb/swagger'\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { PluginOptions } from './types.ts'\nexport const pluginName = 'swagger-ts' satisfies PluginOptions['name']\nexport const pluginKey: PluginOptions['key'] = [pluginName] satisfies PluginOptions['key']\n\nexport const definePlugin = createPlugin<PluginOptions>((options) => {\n const {\n output = { path: 'types' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = '',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n transformers = {},\n oasType = false,\n } = options\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginName,\n options: {\n transformers,\n dateType,\n enumType,\n enumSuffix,\n optionalType,\n oasType,\n // keep the used enumnames between TypeBuilder and OperationGenerator per plugin(pluginKey)\n usedEnumNames: {},\n unknownType,\n },\n pre: [swaggerPluginName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'file') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async writeFile(source, writePath) {\n if (!writePath.endsWith('.ts') || !source) {\n return\n }\n\n return this.fileManager.write(source, writePath, { sanity: false })\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [swaggerPluginName])\n\n const oas = await swaggerPlugin.api.getOas()\n\n const schemas = await swaggerPlugin.api.getSchemas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const builder = new TypeBuilder(this.plugin.options, { oas, pluginManager: this.pluginManager })\n\n builder.add(\n Object.entries(schemas).map(([name, schema]: [string, OasTypes.SchemaObject]) => ({ name, schema })),\n )\n\n if (mode === 'directory') {\n const mapFolderSchema = async ([name]: [string, OasTypes.SchemaObject]) => {\n const baseName = `${this.resolveName({ name, pluginKey: this.plugin.key, type: 'file' })}.ts` as const\n const resolvedPath = this.resolvePath({ baseName, pluginKey: this.plugin.key })\n const { source, imports } = builder.build(name)\n\n if (!resolvedPath) {\n return null\n }\n\n return this.addFile({\n path: resolvedPath,\n baseName,\n source,\n imports: imports.map(item => ({ ...item, root: resolvedPath })),\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const promises = Object.entries(schemas).map(mapFolderSchema)\n\n await Promise.all(promises)\n }\n\n if (mode === 'file') {\n const resolvedPath = this.resolvePath({ baseName: '', pluginKey: this.plugin.key })\n const { source } = builder.build()\n\n if (!resolvedPath) {\n return\n }\n\n await this.addFile({\n path: resolvedPath,\n baseName: output.path as KubbFile.BaseName,\n source,\n imports: [],\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n }\n\n const operationGenerator = new OperationGenerator(\n this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.api.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build()\n await this.addFile(...files)\n },\n async buildEnd() {\n if (this.config.output.write === false) {\n return\n }\n\n const root = path.resolve(this.config.root, this.config.output.path)\n\n await this.fileManager.addIndexes({\n root,\n output,\n meta: { pluginKey: this.plugin.key },\n })\n },\n }\n})\n","import { createRoot } from '@kubb/react'\nimport { OperationGenerator as Generator } from '@kubb/swagger'\nimport { Oas } from '@kubb/swagger/components'\n\nimport { Mutation } from './components/Mutation.tsx'\nimport { OasType } from './components/OasType.tsx'\nimport { Query } from './components/Query.tsx'\n\nimport type { AppContextProps } from '@kubb/react'\nimport type { OperationMethodResult } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { FileMeta, PluginOptions } from './types.ts'\n\nexport class OperationGenerator extends Generator<PluginOptions['resolvedOptions'], PluginOptions> {\n async all(operations: Operation[]): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n\n root.render(\n <Oas oas={oas} operations={operations} getSchemas={(...props) => this.getSchemas(...props)}>\n {plugin.options.oasType && <OasType.File name=\"oas\" typeName=\"Oas\" />}\n </Oas>,\n { meta: { pluginManager, plugin } },\n )\n\n return root.files\n }\n\n async get(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Query.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async post(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n const { oas, pluginManager, plugin, mode = 'directory' } = this.context\n\n const root = createRoot<AppContextProps<PluginOptions['appMeta']>>({ logger: pluginManager.logger })\n root.render(\n <Oas oas={oas} operations={[operation]} getSchemas={(...props) => this.getSchemas(...props)}>\n <Oas.Operation operation={operation}>\n <Mutation.File mode={mode} />\n </Oas.Operation>\n </Oas>,\n { meta: { pluginManager, plugin: { ...plugin, options } } },\n )\n\n return root.files\n }\n\n async put(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async patch(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n async delete(operation: Operation, options: PluginOptions['resolvedOptions']): OperationMethodResult<FileMeta> {\n return this.post(operation, options)\n }\n}\n","import { Editor, File, Type, usePlugin } from '@kubb/react'\nimport { useFile } from '@kubb/react'\nimport { useOas } from '@kubb/swagger/hooks'\n\nimport type { OasTypes } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype TemplateProps = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nfunction Template({\n name,\n typeName,\n api,\n}: TemplateProps): ReactNode {\n return (\n <>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n <br />\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </>\n )\n}\n\nconst defaultTemplates = { default: Template } as const\n\ntype Props = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n Template?: React.ComponentType<React.ComponentProps<typeof Template>>\n}\n\nexport function OasType({\n name,\n typeName,\n Template = defaultTemplates.default,\n}: Props): ReactNode {\n const oas = useOas()\n\n return <Template name={name} typeName={typeName} api={oas.api} />\n}\n\ntype FileProps = {\n name: string\n typeName: string\n /**\n * This will make it possible to override the default behaviour.\n */\n templates?: typeof defaultTemplates\n}\n\nOasType.File = function({ name, typeName, templates = defaultTemplates }: FileProps): ReactNode {\n const { key: pluginKey } = usePlugin<PluginOptions>()\n const file = useFile({ name, extName: '.ts', pluginKey })\n\n const Template = templates.default\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n <File.Import name={['Infer']} path=\"@kubb/swagger-ts/oas\" isTypeOnly />\n <File.Source>\n <OasType Template={Template} name={name} typeName={typeName} />\n </File.Source>\n </File>\n </Editor>\n )\n}\n\nOasType.templates = defaultTemplates\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/parser'\nimport * as factory from '@kubb/parser/factory'\nimport { Editor, File, usePlugin, usePluginManager } from '@kubb/react'\nimport { useOas, useOperation, useOperationFile, useOperationName, useSchemas } from '@kubb/swagger/hooks'\n\nimport { TypeBuilder } from '../TypeBuilder.ts'\n\nimport type { KubbFile } from '@kubb/core'\nimport type { ts } from '@kubb/parser'\nimport type { OperationSchemas } from '@kubb/swagger'\nimport type { Operation } from '@kubb/swagger/oas'\nimport type { ReactNode } from 'react'\nimport type { FileMeta, PluginOptions } from '../types.ts'\n\ntype Props = {\n builder: TypeBuilder\n}\n\nfunction printCombinedSchema(name: string, operation: Operation, schemas: OperationSchemas): string {\n const properties: Record<string, ts.TypeNode> = {\n 'response': factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.response.name),\n undefined,\n ),\n }\n\n if (schemas.request) {\n properties['request'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.request.name),\n undefined,\n )\n }\n\n if (schemas.pathParams) {\n properties['pathParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.pathParams.name),\n undefined,\n )\n }\n\n if (schemas.queryParams) {\n properties['queryParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.queryParams.name),\n undefined,\n )\n }\n\n if (schemas.headerParams) {\n properties['headerParams'] = factory.createTypeReferenceNode(\n factory.createIdentifier(schemas.headerParams.name),\n undefined,\n )\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map(error => {\n return factory.createTypeReferenceNode(\n factory.createIdentifier(error.name),\n undefined,\n )\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name: operation.method === 'get' ? `${name}Query` : `${name}Mutation`,\n type: factory.createTypeLiteralNode(\n Object.keys(properties).map(key => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature(\n {\n name: transformers.pascalCase(key),\n type,\n },\n )\n }).filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport function Query({\n builder,\n}: Props): ReactNode {\n const { source } = builder.build()\n\n return (\n <>\n {source}\n </>\n )\n}\n\ntype FileProps = {\n mode: KubbFile.Mode\n}\n\nQuery.File = function({ mode }: FileProps): ReactNode {\n const { options } = usePlugin<PluginOptions>()\n\n const schemas = useSchemas()\n const pluginManager = usePluginManager()\n const oas = useOas()\n const file = useOperationFile()\n const factoryName = useOperationName({ type: 'type' })\n const operation = useOperation()\n\n const builder = new TypeBuilder(options, { oas, pluginManager })\n .add(schemas.pathParams)\n .add(schemas.queryParams)\n .add(schemas.headerParams)\n .add(schemas.response)\n .add(schemas.statusCodes)\n\n const { source, imports } = builder.build()\n\n return (\n <Editor language=\"typescript\">\n <File<FileMeta>\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n >\n {mode === 'directory' && imports.map((item, index) => {\n return <File.Import key={index} root={file.path} {...item} />\n })}\n <File.Source>\n {source}\n {printCombinedSchema(factoryName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,MAAK,QAAL,EACE;AAAA;AAAA,UACAX,qBAAoB,aAAa,WAAW,OAAO;AAAA,WACtD;AAAA;AAAA;AAAA,EACF,GACF;AAEJ;","names":["transformers","print","factory","Editor","File","usePlugin","usePluginManager","useOas","useOperation","useOperationFile","useOperationName","useSchemas","transformers","print","Generator","transformers","pascalCase","factory","keywordTypeNodes","Template","pluginKey","Editor","File","usePlugin","useOas","Fragment","jsx","jsxs","usePlugin","useOas","Editor","File","jsx","transformers","options","Generator","transformers","node","path","pascalCase","keywordTypeNodes","transformers","print","Fragment","jsx","jsxs","printCombinedSchema","transformers","print","usePlugin","useSchemas","usePluginManager","useOas","useOperationFile","useOperationName","useOperation","Editor","File"]}