@kubb/plugin-ts 5.0.0-alpha.20 → 5.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Type-B6fo0gSk.js +120 -0
- package/dist/Type-B6fo0gSk.js.map +1 -0
- package/dist/Type-oFwUfkZv.cjs +131 -0
- package/dist/Type-oFwUfkZv.cjs.map +1 -0
- package/dist/builderTs-Cd3juc2G.cjs +120 -0
- package/dist/builderTs-Cd3juc2G.cjs.map +1 -0
- package/dist/builderTs-DausqHpc.js +116 -0
- package/dist/builderTs-DausqHpc.js.map +1 -0
- package/dist/builders.cjs +3 -0
- package/dist/builders.d.ts +8 -0
- package/dist/builders.js +2 -0
- package/dist/{casing-Cp-jbC_k.js → casing-BJHFg-zZ.js} +1 -1
- package/dist/{casing-Cp-jbC_k.js.map → casing-BJHFg-zZ.js.map} +1 -1
- package/dist/{casing-D2uQKLWS.cjs → casing-DHfdqpLi.cjs} +2 -39
- package/dist/{casing-D2uQKLWS.cjs.map → casing-DHfdqpLi.cjs.map} +1 -1
- package/dist/chunk-ByKO4r7w.cjs +38 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +1 -2
- package/dist/components.js +1 -1
- package/dist/generators-ByK18qUn.js +551 -0
- package/dist/generators-ByK18qUn.js.map +1 -0
- package/dist/{generators-xHWQCNd9.cjs → generators-aSsiTfUO.cjs} +296 -293
- package/dist/generators-aSsiTfUO.cjs.map +1 -0
- package/dist/generators.cjs +2 -1
- package/dist/generators.d.ts +5 -2
- package/dist/generators.js +2 -2
- package/dist/index.cjs +38 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -35
- package/dist/index.js.map +1 -1
- package/dist/{Type-CMC7L-38.js → printerTs-BgZucv4T.js} +18 -130
- package/dist/printerTs-BgZucv4T.js.map +1 -0
- package/dist/{Type-B70QnSzH.cjs → printerTs-CFXc_LpP.cjs} +40 -133
- package/dist/printerTs-CFXc_LpP.cjs.map +1 -0
- package/dist/printers.cjs +3 -0
- package/dist/printers.d.ts +75 -0
- package/dist/printers.js +2 -0
- package/dist/{resolvers-DsKabI0F.js → resolverTsLegacy-DLl854-P.js} +8 -7
- package/dist/resolverTsLegacy-DLl854-P.js.map +1 -0
- package/dist/{resolvers-YIpeP5YD.cjs → resolverTsLegacy-sJ16Iqrl.cjs} +9 -7
- package/dist/resolverTsLegacy-sJ16Iqrl.cjs.map +1 -0
- package/dist/resolvers.cjs +3 -3
- package/dist/resolvers.d.ts +1 -1
- package/dist/resolvers.js +1 -1
- package/dist/{types-zqLMbIqZ.d.ts → types-BcyuFDn9.d.ts} +26 -22
- package/package.json +17 -5
- package/src/builders/builderTs.ts +92 -0
- package/src/builders/index.ts +1 -0
- package/src/components/Type.tsx +4 -6
- package/src/factory.ts +0 -32
- package/src/generators/index.ts +1 -0
- package/src/generators/typeGenerator.tsx +49 -140
- package/src/generators/typeGeneratorLegacy.tsx +345 -0
- package/src/index.ts +1 -1
- package/src/plugin.ts +15 -44
- package/src/presets.ts +10 -7
- package/src/printers/index.ts +1 -0
- package/src/{printer.ts → printers/printerTs.ts} +20 -16
- package/src/resolvers/resolverTs.ts +7 -4
- package/src/resolvers/resolverTsLegacy.ts +1 -1
- package/src/types.ts +39 -21
- package/dist/Type-B70QnSzH.cjs.map +0 -1
- package/dist/Type-CMC7L-38.js.map +0 -1
- package/dist/generators-BFkr7ecU.js +0 -556
- package/dist/generators-BFkr7ecU.js.map +0 -1
- package/dist/generators-xHWQCNd9.cjs.map +0 -1
- package/dist/resolvers-DsKabI0F.js.map +0 -1
- package/dist/resolvers-YIpeP5YD.cjs.map +0 -1
- package/src/generators/utils.ts +0 -308
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-xHWQCNd9.cjs","names":["pascalCase","File","Type","schemaTypes","ENUM_TYPES_WITH_KEY_SUFFIX"],"sources":["../src/generators/utils.ts","../src/generators/typeGenerator.tsx"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { createProperty, createSchema, narrowSchema, transform } from '@kubb/ast'\nimport type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'\nimport type { ResolverTs } from '../types.ts'\n\ntype BuildParamsSchemaOptions = {\n params: Array<ParameterNode>\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).\n * Each property is a `ref` schema pointing to the individually-resolved parameter type.\n * The ref name includes the parameter location so generated type names follow\n * the `<OperationId><Location><ParamName>` convention.\n */\nexport function buildParamsSchema({ params, node, resolver }: BuildParamsSchemaOptions): SchemaNode {\n return createSchema({\n type: 'object',\n properties: params.map((param) =>\n createProperty({\n name: param.name,\n required: param.required,\n schema: createSchema({\n type: 'ref',\n name: resolver.resolveParamName(node, param),\n }),\n }),\n ),\n })\n}\n\ntype BuildOperationSchemaOptions = {\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:\n * - `data` → request body ref (optional) or `never`\n * - `pathParams` → inline object of path param refs, or `never`\n * - `queryParams` → inline object of query param refs (optional), or `never`\n * - `headerParams` → inline object of header param refs (optional), or `never`\n * - `url` → Express-style template literal (plugin-ts extension, handled by printer)\n */\nexport function buildDataSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {\n const pathParams = node.parameters.filter((p) => p.in === 'path')\n const queryParams = node.parameters.filter((p) => p.in === 'query')\n const headerParams = node.parameters.filter((p) => p.in === 'header')\n\n return createSchema({\n type: 'object',\n deprecated: node.deprecated,\n properties: [\n createProperty({\n name: 'data',\n schema: node.requestBody?.schema\n ? createSchema({\n type: 'ref',\n name: resolver.resolveDataTypedName(node),\n optional: true,\n })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n required: pathParams.length > 0,\n schema: pathParams.length > 0 ? buildParamsSchema({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...buildParamsSchema({ params: queryParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'headerParams',\n schema:\n headerParams.length > 0\n ? createSchema({ ...buildParamsSchema({ params: headerParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'url',\n required: true,\n schema: createSchema({ type: 'url', path: node.path }),\n }),\n ],\n })\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.\n * Numeric status codes produce unquoted numeric keys (e.g. `200:`).\n * All responses are included; those without a schema are represented as a ref to a `never` type.\n */\nexport function buildResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\n if (node.responses.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'object',\n properties: node.responses.map((res) =>\n createProperty({\n name: String(res.statusCode),\n required: true,\n schema: createSchema({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n }),\n ),\n })\n}\n\n/**\n * Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.\n * Returns `null` when the operation has no responses with schemas.\n */\nexport function buildResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\n const responsesWithSchema = node.responses.filter((res) => res.schema)\n\n if (responsesWithSchema.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'union',\n members: responsesWithSchema.map((res) =>\n createSchema({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n ),\n })\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ParameterNode>\n /**\n * Parent type name (e.g. `FindPetsByStatusQueryParams`) used to derive enum names\n * for inline enum properties (e.g. `FindPetsByStatusQueryParamsStatusEnum`).\n */\n parentName?: string\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a grouped parameters type (path/query/header) in legacy mode.\n * Each property directly embeds the parameter's schema inline (not a ref).\n * Used to generate `<OperationId>PathParams`, `<OperationId>QueryParams`, `<OperationId>HeaderParams`.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function buildGroupedParamsSchema({ params, parentName }: BuildGroupedParamsSchemaOptions): SchemaNode {\n return createSchema({\n type: 'object',\n properties: params.map((param) => {\n let schema = param.schema\n if (narrowSchema(schema, 'enum') && !schema.name && parentName) {\n schema = { ...schema, name: pascalCase([parentName, param.name, 'enum'].join(' ')) }\n }\n return createProperty({\n name: param.name,\n required: param.required,\n schema,\n })\n }),\n })\n}\n\n/**\n * Builds the legacy wrapper `ObjectSchemaNode` for `<OperationId>Mutation` / `<OperationId>Query`.\n * Structure: `{ Response, Request?, QueryParams?, PathParams?, HeaderParams?, Errors }`.\n * Mirrors the v4 naming convention where this type acts as a namespace for the operation's shapes.\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function buildLegacyResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\n const isGet = node.method.toLowerCase() === 'get'\n const successResponses = node.responses.filter((res) => {\n const code = Number(res.statusCode)\n return !Number.isNaN(code) && code >= 200 && code < 300\n })\n const errorResponses = node.responses.filter((res) => res.statusCode === 'default' || Number(res.statusCode) >= 400)\n\n const responseSchema =\n successResponses.length > 0\n ? successResponses.length === 1\n ? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })\n : createSchema({\n type: 'union',\n members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n : createSchema({ type: 'any' })\n\n const errorsSchema =\n errorResponses.length > 0\n ? errorResponses.length === 1\n ? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, errorResponses[0]!.statusCode) })\n : createSchema({\n type: 'union',\n members: errorResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n : createSchema({ type: 'any' })\n\n const properties = [createProperty({ name: 'Response', required: true, schema: responseSchema })]\n\n if (!isGet && node.requestBody?.schema) {\n properties.push(\n createProperty({\n name: 'Request',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveDataTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'query') && resolver.resolveQueryParamsTypedName) {\n properties.push(\n createProperty({\n name: 'QueryParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveQueryParamsTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'path') && resolver.resolvePathParamsTypedName) {\n properties.push(\n createProperty({\n name: 'PathParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolvePathParamsTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'header') && resolver.resolveHeaderParamsTypedName) {\n properties.push(\n createProperty({\n name: 'HeaderParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveHeaderParamsTypedName(node) }),\n }),\n )\n }\n\n properties.push(createProperty({ name: 'Errors', required: true, schema: errorsSchema }))\n\n return createSchema({ type: 'object', properties })\n}\n\n/**\n * Builds the legacy response union for `<OperationId>MutationResponse` / `<OperationId>QueryResponse`.\n * In legacy mode this is the **success** response only (not the full union including errors).\n * Returns an `any` schema when there is no success response, matching v4 behavior.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function buildLegacyResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {\n const successResponses = node.responses.filter((res) => {\n const code = Number(res.statusCode)\n return !Number.isNaN(code) && code >= 200 && code < 300\n })\n\n if (successResponses.length === 0) {\n return createSchema({ type: 'any' })\n }\n\n if (successResponses.length === 1) {\n return createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })\n }\n\n return createSchema({\n type: 'union',\n members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n}\n\n/**\n * Names unnamed enum nodes within a schema tree based on the parent type name.\n * Used in legacy mode to ensure inline enums in response/request schemas get\n * extracted as named enum declarations (e.g. `DeletePet200Enum`).\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {\n return transform(node, {\n schema(n) {\n const enumNode = narrowSchema(n, 'enum')\n if (enumNode && !enumNode.name) {\n return { ...enumNode, name: pascalCase([parentName, 'enum'].join(' ')) }\n }\n return undefined\n },\n property(p) {\n const enumNode = narrowSchema(p.schema, 'enum')\n if (enumNode && !enumNode.name) {\n return {\n ...p,\n schema: { ...enumNode, name: pascalCase([parentName, p.name, 'enum'].join(' ')) },\n }\n }\n return undefined\n },\n })\n}\n","import { caseParams, composeTransformers, narrowSchema, schemaTypes, transform } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator } from '@kubb/core'\nimport { useKubb } from '@kubb/core/hooks'\nimport { File } from '@kubb/react-fabric'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport type { PluginTs } from '../types'\nimport {\n buildDataSchemaNode,\n buildGroupedParamsSchema,\n buildLegacyResponsesSchemaNode,\n buildLegacyResponseUnionSchemaNode,\n buildParamsSchema,\n buildResponsesSchemaNode,\n buildResponseUnionSchemaNode,\n nameUnnamedEnums,\n} from './utils.ts'\n\nexport const typeGenerator = defineGenerator<PluginTs>({\n name: 'typescript',\n type: 'react',\n Operation({ node, adapter, options }) {\n const {\n enumType,\n enumKeyCasing,\n optionalType,\n arrayType,\n syntaxType,\n paramsCasing,\n group,\n resolver,\n baseResolver,\n compatibilityPreset,\n transformers = [],\n } = options\n const isKubbV4Compatibility = compatibilityPreset === 'kubbV4'\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n const file = getFile({\n name: node.operationId,\n extname: '.ts',\n mode,\n options: {\n group: group ? (group.type === 'tag' ? { tag: node.tags[0] ?? 'default' } : { path: node.path }) : undefined,\n },\n })\n const params = caseParams(node.parameters, paramsCasing)\n\n function renderSchemaType({\n node: schemaNode,\n name,\n typedName,\n description,\n keysToOmit,\n }: {\n node: SchemaNode | null\n name: string\n typedName: string\n description?: string\n keysToOmit?: Array<string>\n }) {\n if (!schemaNode) {\n return null\n }\n\n const transformedNode = transform(schemaNode, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={name}\n typedName={typedName}\n node={transformedNode}\n description={description}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n keysToOmit={keysToOmit}\n legacy={isKubbV4Compatibility}\n />\n </>\n )\n }\n\n const responseTypes = isKubbV4Compatibility\n ? node.responses.map((res) => {\n const responseName = resolver.resolveResponseStatusName(node, res.statusCode)\n const baseResponseName = baseResolver.resolveResponseStatusName(node, res.statusCode)\n\n return renderSchemaType({\n node: res.schema ? nameUnnamedEnums(res.schema, baseResponseName) : res.schema,\n name: responseName,\n typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n description: res.description,\n keysToOmit: res.keysToOmit,\n })\n })\n : node.responses.map((res) =>\n renderSchemaType({\n node: res.schema,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n description: res.description,\n keysToOmit: res.keysToOmit,\n }),\n )\n\n const requestType = node.requestBody?.schema\n ? renderSchemaType({\n node: isKubbV4Compatibility ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(node)) : node.requestBody.schema,\n name: resolver.resolveDataName(node),\n typedName: resolver.resolveDataTypedName(node),\n description: node.requestBody.description ?? node.requestBody.schema.description,\n keysToOmit: node.requestBody.keysToOmit,\n })\n : null\n\n if (isKubbV4Compatibility) {\n const pathParams = params.filter((p) => p.in === 'path')\n const queryParams = params.filter((p) => p.in === 'query')\n const headerParams = params.filter((p) => p.in === 'header')\n\n const legacyParamTypes = [\n pathParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: pathParams, parentName: baseResolver.resolvePathParamsName!(node) }),\n name: resolver.resolvePathParamsName!(node),\n typedName: resolver.resolvePathParamsTypedName!(node),\n })\n : null,\n queryParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: queryParams, parentName: baseResolver.resolveQueryParamsName!(node) }),\n name: resolver.resolveQueryParamsName!(node),\n typedName: resolver.resolveQueryParamsTypedName!(node),\n })\n : null,\n headerParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: headerParams, parentName: baseResolver.resolveHeaderParamsName!(node) }),\n name: resolver.resolveHeaderParamsName!(node),\n typedName: resolver.resolveHeaderParamsTypedName!(node),\n })\n : null,\n ]\n\n const legacyResponsesType = renderSchemaType({\n node: buildLegacyResponsesSchemaNode({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const legacyResponseType = renderSchemaType({\n node: buildLegacyResponseUnionSchemaNode({ node, resolver }),\n name: resolver.resolveResponseName(node),\n typedName: resolver.resolveResponseTypedName(node),\n })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {legacyParamTypes}\n {responseTypes}\n {requestType}\n {legacyResponseType}\n {legacyResponsesType}\n </File>\n )\n }\n\n const paramTypes = params.map((param) =>\n renderSchemaType({\n node: param.schema,\n name: resolver.resolveParamName(node, param),\n typedName: resolver.resolveParamTypedName(node, param),\n }),\n )\n\n const queryParamsList = params.filter((p) => p.in === 'query')\n const queryParamsType =\n queryParamsList.length > 0\n ? renderSchemaType({\n node: buildParamsSchema({ params: queryParamsList, node, resolver }),\n name: resolver.resolveQueryParamsName!(node),\n typedName: resolver.resolveQueryParamsTypedName!(node),\n })\n : null\n\n const dataType = renderSchemaType({\n node: buildDataSchemaNode({ node: { ...node, parameters: params }, resolver }),\n name: resolver.resolveRequestConfigName(node),\n typedName: resolver.resolveRequestConfigTypedName(node),\n })\n\n const responsesType = renderSchemaType({\n node: buildResponsesSchemaNode({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const responseType = renderSchemaType({\n node: buildResponseUnionSchemaNode({ node, resolver }),\n name: resolver.resolveResponseName(node),\n typedName: resolver.resolveResponseTypedName(node),\n description: 'Union of all possible responses',\n })\n\n return (\n <File baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {paramTypes}\n {queryParamsType}\n {responseTypes}\n {requestType}\n {dataType}\n {responsesType}\n {responseType}\n </File>\n )\n },\n Schema({ node, adapter, options }) {\n const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, compatibilityPreset, transformers = [] } = options\n const isKubbV4Compatibility = compatibilityPreset === 'kubbV4'\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n if (!node.name) {\n return\n }\n\n const transformedNode = transform(node, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)\n\n const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name)\n\n const type = {\n name: resolver.resolveName(node.name),\n typedName,\n file: getFile({ name: node.name, extname: '.ts', mode }),\n } as const\n\n return (\n <File baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n node={transformedNode}\n enumType={enumType}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n legacy={isKubbV4Compatibility}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,QAAQ,MAAM,YAAkD;AAClG,SAAA,GAAA,UAAA,cAAoB;EAClB,MAAM;EACN,YAAY,OAAO,KAAK,WAAA,GAAA,UAAA,gBACP;GACb,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,SAAA,GAAA,UAAA,cAAqB;IACnB,MAAM;IACN,MAAM,SAAS,iBAAiB,MAAM,MAAM;IAC7C,CAAC;GACH,CAAC,CACH;EACF,CAAC;;;;;;;;;;AAgBJ,SAAgB,oBAAoB,EAAE,MAAM,YAAqD;CAC/F,MAAM,aAAa,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,OAAO;CACjE,MAAM,cAAc,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,QAAQ;CACnE,MAAM,eAAe,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,SAAS;AAErE,SAAA,GAAA,UAAA,cAAoB;EAClB,MAAM;EACN,YAAY,KAAK;EACjB,YAAY;iCACK;IACb,MAAM;IACN,QAAQ,KAAK,aAAa,UAAA,GAAA,UAAA,cACT;KACX,MAAM;KACN,MAAM,SAAS,qBAAqB,KAAK;KACzC,UAAU;KACX,CAAC,IAAA,GAAA,UAAA,cACW;KAAE,MAAM;KAAS,UAAU;KAAM,CAAC;IACpD,CAAC;iCACa;IACb,MAAM;IACN,UAAU,WAAW,SAAS;IAC9B,QAAQ,WAAW,SAAS,IAAI,kB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 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers-DsKabI0F.js","names":[],"sources":["../src/resolvers/resolverTs.ts","../src/resolvers/resolverTsLegacy.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\n\nfunction resolveName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string {\n return pascalCase(name, { isFile: type === 'file' })\n}\n\n/**\n * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution\n * helpers used by the plugin. Import this in other plugins to resolve the exact names and\n * paths that `plugin-ts` generates without hardcoding the conventions.\n *\n * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`\n * for identifiers/files and `pascalCase` for type names.\n *\n * @example\n * ```ts\n * import { resolver } from '@kubb/plugin-ts'\n *\n * resolver.default('list pets', 'type') // → 'ListPets'\n * resolver.resolveName('list pets status 200') // → 'listPetsStatus200'\n * resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'\n * resolver.resolvePathName('list pets', 'file') // → 'listPets'\n * ```\n */\nexport const resolverTs = defineResolver<PluginTs>(() => {\n return {\n name: 'default',\n default(name, type) {\n return resolveName(name, type)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolveTypedName(name) {\n return this.default(name, 'type')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveParamTypedName(node, param) {\n return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveName(`${node.operationId} Status ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n return this.resolveTypedName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveName(`${node.operationId} Data`)\n },\n resolveDataTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Data`)\n },\n resolveRequestConfigName(node) {\n return this.resolveName(`${node.operationId} RequestConfig`)\n },\n resolveRequestConfigTypedName(node) {\n return this.resolveTypedName(`${node.operationId} RequestConfig`)\n },\n resolveResponsesName(node) {\n return this.resolveName(`${node.operationId} Responses`)\n },\n resolveResponsesTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveName(`${node.operationId} Response`)\n },\n resolveResponseTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Response`)\n },\n resolveEnumKeyTypedName(node) {\n return `${this.resolveTypedName(node.name ?? '')}Key`\n },\n resolvePathParamsName(_node) {\n throw new Error(\"resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolvePathParamsTypedName(_node) {\n throw new Error(\n \"resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\n },\n resolveQueryParamsName(node) {\n return this.resolveName(`${node.operationId} QueryParams`)\n },\n resolveQueryParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} QueryParams`)\n },\n resolveHeaderParamsName(_node) {\n throw new Error(\"resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolveHeaderParamsTypedName(_node) {\n throw new Error(\n \"resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\n },\n }\n})\n","import { defineResolver } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\nimport { resolverTs } from './resolverTs.ts'\n\n/**\n * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions\n * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`\n * (or by composing this resolver manually).\n *\n * Key differences from the default resolver:\n * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`\n * - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`\n * - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)\n * - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`\n * - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`\n *\n * @example\n * ```ts\n * import { resolverTsLegacy } from '@kubb/plugin-ts'\n *\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'\n * resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)\n * resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)\n * resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)\n * ```\n */\nexport const resolverTsLegacy = defineResolver<PluginTs>(() => {\n return {\n ...resolverTs,\n name: 'legacy',\n resolveResponseStatusName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveName(`${node.operationId} Error`)\n }\n return this.resolveName(`${node.operationId} ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveTypedName(`${node.operationId} Error`)\n }\n return this.resolveTypedName(`${node.operationId} ${statusCode}`)\n },\n resolveDataName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveDataTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolveResponsesName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return `${this.default(node.operationId, 'function')}${suffix}`\n },\n resolveResponsesTypedName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return `${this.default(node.operationId, 'type')}${suffix}`\n },\n resolveResponseName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveResponseTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolvePathParamsName(node) {\n return this.resolveName(`${node.operationId} PathParams`)\n },\n resolvePathParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} PathParams`)\n },\n resolveQueryParamsName(node) {\n return this.resolveName(`${node.operationId} QueryParams`)\n },\n resolveQueryParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} QueryParams`)\n },\n resolveHeaderParamsName(node) {\n return this.resolveName(`${node.operationId} HeaderParams`)\n },\n resolveHeaderParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} HeaderParams`)\n },\n }\n})\n"],"mappings":";;;;AAIA,SAAS,YAAY,MAAc,MAAuD;AACxF,QAAO,WAAW,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;AAqBtD,MAAa,aAAa,qBAA+B;AACvD,QAAO;EACL,MAAM;EACN,QAAQ,MAAM,MAAM;AAClB,UAAO,YAAY,MAAM,KAAK;;EAEhC,YAAY,MAAM;AAChB,UAAO,KAAK,QAAQ,MAAM,WAAW;;EAEvC,iBAAiB,MAAM;AACrB,UAAO,KAAK,QAAQ,MAAM,OAAO;;EAEnC,gBAAgB,MAAM,MAAM;AAC1B,UAAO,KAAK,QAAQ,MAAM,KAAK;;EAEjC,iBAAiB,MAAM,OAAO;AAC5B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,GAAG,KAAK,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM,OAAO;;EAExF,sBAAsB,MAAM,OAAO;AACjC,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,GAAG,KAAK,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM,OAAO;;EAE7F,0BAA0B,MAAM,YAAY;AAC1C,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,UAAU,aAAa;;EAErE,+BAA+B,MAAM,YAAY;AAC/C,U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AA4B,MAAM;AAChC,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,cAAc;;EAEjE,wBAAwB,MAAM;AAC5B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,eAAe;;EAE7D,6BAA6B,MAAM;AACjC,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,eAAe;;EAEnE;EACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers-YIpeP5YD.cjs","names":["pascalCase"],"sources":["../src/resolvers/resolverTs.ts","../src/resolvers/resolverTsLegacy.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\n\nfunction resolveName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string {\n return pascalCase(name, { isFile: type === 'file' })\n}\n\n/**\n * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution\n * helpers used by the plugin. Import this in other plugins to resolve the exact names and\n * paths that `plugin-ts` generates without hardcoding the conventions.\n *\n * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`\n * for identifiers/files and `pascalCase` for type names.\n *\n * @example\n * ```ts\n * import { resolver } from '@kubb/plugin-ts'\n *\n * resolver.default('list pets', 'type') // → 'ListPets'\n * resolver.resolveName('list pets status 200') // → 'listPetsStatus200'\n * resolver.resolveTypedName('list pets status 200') // → 'ListPetsStatus200'\n * resolver.resolvePathName('list pets', 'file') // → 'listPets'\n * ```\n */\nexport const resolverTs = defineResolver<PluginTs>(() => {\n return {\n name: 'default',\n default(name, type) {\n return resolveName(name, type)\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolveTypedName(name) {\n return this.default(name, 'type')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveParamName(node, param) {\n return this.resolveName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveParamTypedName(node, param) {\n return this.resolveTypedName(`${node.operationId} ${this.default(param.in)} ${param.name}`)\n },\n resolveResponseStatusName(node, statusCode) {\n return this.resolveName(`${node.operationId} Status ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n return this.resolveTypedName(`${node.operationId} Status ${statusCode}`)\n },\n resolveDataName(node) {\n return this.resolveName(`${node.operationId} Data`)\n },\n resolveDataTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Data`)\n },\n resolveRequestConfigName(node) {\n return this.resolveName(`${node.operationId} RequestConfig`)\n },\n resolveRequestConfigTypedName(node) {\n return this.resolveTypedName(`${node.operationId} RequestConfig`)\n },\n resolveResponsesName(node) {\n return this.resolveName(`${node.operationId} Responses`)\n },\n resolveResponsesTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Responses`)\n },\n resolveResponseName(node) {\n return this.resolveName(`${node.operationId} Response`)\n },\n resolveResponseTypedName(node) {\n return this.resolveTypedName(`${node.operationId} Response`)\n },\n resolveEnumKeyTypedName(node) {\n return `${this.resolveTypedName(node.name ?? '')}Key`\n },\n resolvePathParamsName(_node) {\n throw new Error(\"resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolvePathParamsTypedName(_node) {\n throw new Error(\n \"resolvePathParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\n },\n resolveQueryParamsName(node) {\n return this.resolveName(`${node.operationId} QueryParams`)\n },\n resolveQueryParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} QueryParams`)\n },\n resolveHeaderParamsName(_node) {\n throw new Error(\"resolveHeaderParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.\")\n },\n resolveHeaderParamsTypedName(_node) {\n throw new Error(\n \"resolveHeaderParamsTypedName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamTypedName per individual parameter instead.\",\n )\n },\n }\n})\n","import { defineResolver } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\nimport { resolverTs } from './resolverTs.ts'\n\n/**\n * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions\n * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`\n * (or by composing this resolver manually).\n *\n * Key differences from the default resolver:\n * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`\n * - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`\n * - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)\n * - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`\n * - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`\n *\n * @example\n * ```ts\n * import { resolverTsLegacy } from '@kubb/plugin-ts'\n *\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'\n * resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'\n * resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)\n * resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)\n * resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)\n * ```\n */\nexport const resolverTsLegacy = defineResolver<PluginTs>(() => {\n return {\n ...resolverTs,\n name: 'legacy',\n resolveResponseStatusName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveName(`${node.operationId} Error`)\n }\n return this.resolveName(`${node.operationId} ${statusCode}`)\n },\n resolveResponseStatusTypedName(node, statusCode) {\n if (statusCode === 'default') {\n return this.resolveTypedName(`${node.operationId} Error`)\n }\n return this.resolveTypedName(`${node.operationId} ${statusCode}`)\n },\n resolveDataName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveDataTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryRequest' : 'MutationRequest'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolveResponsesName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return `${this.default(node.operationId, 'function')}${suffix}`\n },\n resolveResponsesTypedName(node) {\n const suffix = node.method === 'GET' ? 'Query' : 'Mutation'\n return `${this.default(node.operationId, 'type')}${suffix}`\n },\n resolveResponseName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveName(`${node.operationId} ${suffix}`)\n },\n resolveResponseTypedName(node) {\n const suffix = node.method === 'GET' ? 'QueryResponse' : 'MutationResponse'\n return this.resolveTypedName(`${node.operationId} ${suffix}`)\n },\n resolvePathParamsName(node) {\n return this.resolveName(`${node.operationId} PathParams`)\n },\n resolvePathParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} PathParams`)\n },\n resolveQueryParamsName(node) {\n return this.resolveName(`${node.operationId} QueryParams`)\n },\n resolveQueryParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} QueryParams`)\n },\n resolveHeaderParamsName(node) {\n return this.resolveName(`${node.operationId} HeaderParams`)\n },\n resolveHeaderParamsTypedName(node) {\n return this.resolveTypedName(`${node.operationId} HeaderParams`)\n },\n }\n})\n"],"mappings":";;;AAIA,SAAS,YAAY,MAAc,MAAuD;AACxF,QAAOA,eAAAA,WAAW,MAAM,EAAE,QAAQ,SAAS,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;AAqBtD,MAAa,cAAA,GAAA,WAAA,sBAA4C;AACvD,QAAO;EACL,MAAM;EACN,QAAQ,MAAM,MAAM;AAClB,UAAO,YAAY,MAAM,KAAK;;EAEhC,YAAY,MAAM;AAChB,UAAO,KAAK,QAAQ,MAAM,WAAW;;EAEvC,iBAAiB,MAAM;AACrB,UAAO,KAAK,QAAQ,MAAM,OAAO;;EAEnC,gBAAgB,MAAM,MAAM;AAC1B,UAAO,KAAK,QAAQ,MAAM,KAAK;;EAEjC,iBAAiB,MAAM,OAAO;AAC5B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,GAAG,KAAK,QAAQ,MAAM,GAAG,C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,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,GAAG,SAAS;;EAE/D,sBAAsB,MAAM;AAC1B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,aAAa;;EAE3D,2BAA2B,MAAM;AAC/B,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,aAAa;;EAEhE,uBAAuB,MAAM;AAC3B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,cAAc;;EAE5D,4BAA4B,MAAM;AAChC,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,cAAc;;EAEjE,wBAAwB,MAAM;AAC5B,UAAO,KAAK,YAAY,GAAG,KAAK,YAAY,eAAe;;EAE7D,6BAA6B,MAAM;AACjC,UAAO,KAAK,iBAAiB,GAAG,KAAK,YAAY,eAAe;;EAEnE;EACD"}
|
package/src/generators/utils.ts
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
import { pascalCase } from '@internals/utils'
|
|
2
|
-
import { createProperty, createSchema, narrowSchema, transform } from '@kubb/ast'
|
|
3
|
-
import type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'
|
|
4
|
-
import type { ResolverTs } from '../types.ts'
|
|
5
|
-
|
|
6
|
-
type BuildParamsSchemaOptions = {
|
|
7
|
-
params: Array<ParameterNode>
|
|
8
|
-
node: OperationNode
|
|
9
|
-
resolver: ResolverTs
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).
|
|
14
|
-
* Each property is a `ref` schema pointing to the individually-resolved parameter type.
|
|
15
|
-
* The ref name includes the parameter location so generated type names follow
|
|
16
|
-
* the `<OperationId><Location><ParamName>` convention.
|
|
17
|
-
*/
|
|
18
|
-
export function buildParamsSchema({ params, node, resolver }: BuildParamsSchemaOptions): SchemaNode {
|
|
19
|
-
return createSchema({
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: params.map((param) =>
|
|
22
|
-
createProperty({
|
|
23
|
-
name: param.name,
|
|
24
|
-
required: param.required,
|
|
25
|
-
schema: createSchema({
|
|
26
|
-
type: 'ref',
|
|
27
|
-
name: resolver.resolveParamName(node, param),
|
|
28
|
-
}),
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type BuildOperationSchemaOptions = {
|
|
35
|
-
node: OperationNode
|
|
36
|
-
resolver: ResolverTs
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:
|
|
41
|
-
* - `data` → request body ref (optional) or `never`
|
|
42
|
-
* - `pathParams` → inline object of path param refs, or `never`
|
|
43
|
-
* - `queryParams` → inline object of query param refs (optional), or `never`
|
|
44
|
-
* - `headerParams` → inline object of header param refs (optional), or `never`
|
|
45
|
-
* - `url` → Express-style template literal (plugin-ts extension, handled by printer)
|
|
46
|
-
*/
|
|
47
|
-
export function buildDataSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {
|
|
48
|
-
const pathParams = node.parameters.filter((p) => p.in === 'path')
|
|
49
|
-
const queryParams = node.parameters.filter((p) => p.in === 'query')
|
|
50
|
-
const headerParams = node.parameters.filter((p) => p.in === 'header')
|
|
51
|
-
|
|
52
|
-
return createSchema({
|
|
53
|
-
type: 'object',
|
|
54
|
-
deprecated: node.deprecated,
|
|
55
|
-
properties: [
|
|
56
|
-
createProperty({
|
|
57
|
-
name: 'data',
|
|
58
|
-
schema: node.requestBody?.schema
|
|
59
|
-
? createSchema({
|
|
60
|
-
type: 'ref',
|
|
61
|
-
name: resolver.resolveDataTypedName(node),
|
|
62
|
-
optional: true,
|
|
63
|
-
})
|
|
64
|
-
: createSchema({ type: 'never', optional: true }),
|
|
65
|
-
}),
|
|
66
|
-
createProperty({
|
|
67
|
-
name: 'pathParams',
|
|
68
|
-
required: pathParams.length > 0,
|
|
69
|
-
schema: pathParams.length > 0 ? buildParamsSchema({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),
|
|
70
|
-
}),
|
|
71
|
-
createProperty({
|
|
72
|
-
name: 'queryParams',
|
|
73
|
-
schema:
|
|
74
|
-
queryParams.length > 0
|
|
75
|
-
? createSchema({ ...buildParamsSchema({ params: queryParams, node, resolver }), optional: true })
|
|
76
|
-
: createSchema({ type: 'never', optional: true }),
|
|
77
|
-
}),
|
|
78
|
-
createProperty({
|
|
79
|
-
name: 'headerParams',
|
|
80
|
-
schema:
|
|
81
|
-
headerParams.length > 0
|
|
82
|
-
? createSchema({ ...buildParamsSchema({ params: headerParams, node, resolver }), optional: true })
|
|
83
|
-
: createSchema({ type: 'never', optional: true }),
|
|
84
|
-
}),
|
|
85
|
-
createProperty({
|
|
86
|
-
name: 'url',
|
|
87
|
-
required: true,
|
|
88
|
-
schema: createSchema({ type: 'url', path: node.path }),
|
|
89
|
-
}),
|
|
90
|
-
],
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.
|
|
96
|
-
* Numeric status codes produce unquoted numeric keys (e.g. `200:`).
|
|
97
|
-
* All responses are included; those without a schema are represented as a ref to a `never` type.
|
|
98
|
-
*/
|
|
99
|
-
export function buildResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {
|
|
100
|
-
if (node.responses.length === 0) {
|
|
101
|
-
return null
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return createSchema({
|
|
105
|
-
type: 'object',
|
|
106
|
-
properties: node.responses.map((res) =>
|
|
107
|
-
createProperty({
|
|
108
|
-
name: String(res.statusCode),
|
|
109
|
-
required: true,
|
|
110
|
-
schema: createSchema({
|
|
111
|
-
type: 'ref',
|
|
112
|
-
name: resolver.resolveResponseStatusTypedName(node, res.statusCode),
|
|
113
|
-
}),
|
|
114
|
-
}),
|
|
115
|
-
),
|
|
116
|
-
})
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.
|
|
121
|
-
* Returns `null` when the operation has no responses with schemas.
|
|
122
|
-
*/
|
|
123
|
-
export function buildResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {
|
|
124
|
-
const responsesWithSchema = node.responses.filter((res) => res.schema)
|
|
125
|
-
|
|
126
|
-
if (responsesWithSchema.length === 0) {
|
|
127
|
-
return null
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return createSchema({
|
|
131
|
-
type: 'union',
|
|
132
|
-
members: responsesWithSchema.map((res) =>
|
|
133
|
-
createSchema({
|
|
134
|
-
type: 'ref',
|
|
135
|
-
name: resolver.resolveResponseStatusTypedName(node, res.statusCode),
|
|
136
|
-
}),
|
|
137
|
-
),
|
|
138
|
-
})
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
type BuildGroupedParamsSchemaOptions = {
|
|
142
|
-
params: Array<ParameterNode>
|
|
143
|
-
/**
|
|
144
|
-
* Parent type name (e.g. `FindPetsByStatusQueryParams`) used to derive enum names
|
|
145
|
-
* for inline enum properties (e.g. `FindPetsByStatusQueryParamsStatusEnum`).
|
|
146
|
-
*/
|
|
147
|
-
parentName?: string
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Builds an `ObjectSchemaNode` for a grouped parameters type (path/query/header) in legacy mode.
|
|
152
|
-
* Each property directly embeds the parameter's schema inline (not a ref).
|
|
153
|
-
* Used to generate `<OperationId>PathParams`, `<OperationId>QueryParams`, `<OperationId>HeaderParams`.
|
|
154
|
-
* @deprecated Legacy only — will be removed in v6.
|
|
155
|
-
*/
|
|
156
|
-
export function buildGroupedParamsSchema({ params, parentName }: BuildGroupedParamsSchemaOptions): SchemaNode {
|
|
157
|
-
return createSchema({
|
|
158
|
-
type: 'object',
|
|
159
|
-
properties: params.map((param) => {
|
|
160
|
-
let schema = param.schema
|
|
161
|
-
if (narrowSchema(schema, 'enum') && !schema.name && parentName) {
|
|
162
|
-
schema = { ...schema, name: pascalCase([parentName, param.name, 'enum'].join(' ')) }
|
|
163
|
-
}
|
|
164
|
-
return createProperty({
|
|
165
|
-
name: param.name,
|
|
166
|
-
required: param.required,
|
|
167
|
-
schema,
|
|
168
|
-
})
|
|
169
|
-
}),
|
|
170
|
-
})
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Builds the legacy wrapper `ObjectSchemaNode` for `<OperationId>Mutation` / `<OperationId>Query`.
|
|
175
|
-
* Structure: `{ Response, Request?, QueryParams?, PathParams?, HeaderParams?, Errors }`.
|
|
176
|
-
* Mirrors the v4 naming convention where this type acts as a namespace for the operation's shapes.
|
|
177
|
-
*
|
|
178
|
-
* @deprecated Legacy only — will be removed in v6.
|
|
179
|
-
*/
|
|
180
|
-
export function buildLegacyResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {
|
|
181
|
-
const isGet = node.method.toLowerCase() === 'get'
|
|
182
|
-
const successResponses = node.responses.filter((res) => {
|
|
183
|
-
const code = Number(res.statusCode)
|
|
184
|
-
return !Number.isNaN(code) && code >= 200 && code < 300
|
|
185
|
-
})
|
|
186
|
-
const errorResponses = node.responses.filter((res) => res.statusCode === 'default' || Number(res.statusCode) >= 400)
|
|
187
|
-
|
|
188
|
-
const responseSchema =
|
|
189
|
-
successResponses.length > 0
|
|
190
|
-
? successResponses.length === 1
|
|
191
|
-
? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })
|
|
192
|
-
: createSchema({
|
|
193
|
-
type: 'union',
|
|
194
|
-
members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),
|
|
195
|
-
})
|
|
196
|
-
: createSchema({ type: 'any' })
|
|
197
|
-
|
|
198
|
-
const errorsSchema =
|
|
199
|
-
errorResponses.length > 0
|
|
200
|
-
? errorResponses.length === 1
|
|
201
|
-
? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, errorResponses[0]!.statusCode) })
|
|
202
|
-
: createSchema({
|
|
203
|
-
type: 'union',
|
|
204
|
-
members: errorResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),
|
|
205
|
-
})
|
|
206
|
-
: createSchema({ type: 'any' })
|
|
207
|
-
|
|
208
|
-
const properties = [createProperty({ name: 'Response', required: true, schema: responseSchema })]
|
|
209
|
-
|
|
210
|
-
if (!isGet && node.requestBody?.schema) {
|
|
211
|
-
properties.push(
|
|
212
|
-
createProperty({
|
|
213
|
-
name: 'Request',
|
|
214
|
-
required: true,
|
|
215
|
-
schema: createSchema({ type: 'ref', name: resolver.resolveDataTypedName(node) }),
|
|
216
|
-
}),
|
|
217
|
-
)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (node.parameters.some((p) => p.in === 'query') && resolver.resolveQueryParamsTypedName) {
|
|
221
|
-
properties.push(
|
|
222
|
-
createProperty({
|
|
223
|
-
name: 'QueryParams',
|
|
224
|
-
required: true,
|
|
225
|
-
schema: createSchema({ type: 'ref', name: resolver.resolveQueryParamsTypedName(node) }),
|
|
226
|
-
}),
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (node.parameters.some((p) => p.in === 'path') && resolver.resolvePathParamsTypedName) {
|
|
231
|
-
properties.push(
|
|
232
|
-
createProperty({
|
|
233
|
-
name: 'PathParams',
|
|
234
|
-
required: true,
|
|
235
|
-
schema: createSchema({ type: 'ref', name: resolver.resolvePathParamsTypedName(node) }),
|
|
236
|
-
}),
|
|
237
|
-
)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (node.parameters.some((p) => p.in === 'header') && resolver.resolveHeaderParamsTypedName) {
|
|
241
|
-
properties.push(
|
|
242
|
-
createProperty({
|
|
243
|
-
name: 'HeaderParams',
|
|
244
|
-
required: true,
|
|
245
|
-
schema: createSchema({ type: 'ref', name: resolver.resolveHeaderParamsTypedName(node) }),
|
|
246
|
-
}),
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
properties.push(createProperty({ name: 'Errors', required: true, schema: errorsSchema }))
|
|
251
|
-
|
|
252
|
-
return createSchema({ type: 'object', properties })
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Builds the legacy response union for `<OperationId>MutationResponse` / `<OperationId>QueryResponse`.
|
|
257
|
-
* In legacy mode this is the **success** response only (not the full union including errors).
|
|
258
|
-
* Returns an `any` schema when there is no success response, matching v4 behavior.
|
|
259
|
-
* @deprecated Legacy only — will be removed in v6.
|
|
260
|
-
*/
|
|
261
|
-
export function buildLegacyResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {
|
|
262
|
-
const successResponses = node.responses.filter((res) => {
|
|
263
|
-
const code = Number(res.statusCode)
|
|
264
|
-
return !Number.isNaN(code) && code >= 200 && code < 300
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
if (successResponses.length === 0) {
|
|
268
|
-
return createSchema({ type: 'any' })
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (successResponses.length === 1) {
|
|
272
|
-
return createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return createSchema({
|
|
276
|
-
type: 'union',
|
|
277
|
-
members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),
|
|
278
|
-
})
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Names unnamed enum nodes within a schema tree based on the parent type name.
|
|
283
|
-
* Used in legacy mode to ensure inline enums in response/request schemas get
|
|
284
|
-
* extracted as named enum declarations (e.g. `DeletePet200Enum`).
|
|
285
|
-
*
|
|
286
|
-
* @deprecated Legacy only — will be removed in v6.
|
|
287
|
-
*/
|
|
288
|
-
export function nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {
|
|
289
|
-
return transform(node, {
|
|
290
|
-
schema(n) {
|
|
291
|
-
const enumNode = narrowSchema(n, 'enum')
|
|
292
|
-
if (enumNode && !enumNode.name) {
|
|
293
|
-
return { ...enumNode, name: pascalCase([parentName, 'enum'].join(' ')) }
|
|
294
|
-
}
|
|
295
|
-
return undefined
|
|
296
|
-
},
|
|
297
|
-
property(p) {
|
|
298
|
-
const enumNode = narrowSchema(p.schema, 'enum')
|
|
299
|
-
if (enumNode && !enumNode.name) {
|
|
300
|
-
return {
|
|
301
|
-
...p,
|
|
302
|
-
schema: { ...enumNode, name: pascalCase([parentName, p.name, 'enum'].join(' ')) },
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return undefined
|
|
306
|
-
},
|
|
307
|
-
})
|
|
308
|
-
}
|