@kubb/plugin-ts 5.0.0-beta.94 → 5.0.0-beta.98

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/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
2
  import { KubbReactNode } from "kubb/jsx";
3
3
  import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit";
4
4
  import ts from "typescript";
5
+ import "@kubb/adapter-oas";
5
6
  //#region src/printers/printerTs.d.ts
6
7
  /**
7
8
  * Partial map of node-type overrides for the TypeScript printer.
@@ -77,11 +78,6 @@ type PrinterTsOptions = {
77
78
  * Schema names that represent enums for suffixed key references.
78
79
  */
79
80
  enumSchemaNames?: Set<string>;
80
- /**
81
- * Maps a component `$ref` path to its collision-resolved name, so a reference to a renamed
82
- * component (e.g. `#/components/schemas/Order` → `OrderSchema`) emits the renamed name.
83
- */
84
- nameMapping?: ReadonlyMap<string, string>;
85
81
  /**
86
82
  * Custom handler map for node type overrides.
87
83
  */
@@ -450,16 +446,6 @@ type Props$1 = {
450
446
  resolver: ResolverTs;
451
447
  key?: string | number | null;
452
448
  };
453
- /**
454
- * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.
455
- *
456
- * The raw `node.name` may be a YAML key such as `"enumNames.Type"` which is not a
457
- * valid TypeScript identifier. The resolver normalizes it. For inline enum properties the adapter
458
- * already emits a PascalCase+suffix name, so resolution is typically a no-op.
459
- *
460
- * When `constCasing` is `'pascalCase'` and `typeSuffix` is empty, the const and the type
461
- * resolve to the same name, which TypeScript merges into a single value+type declaration.
462
- */
463
449
  /**
464
450
  * Renders the enum declaration(s) for a single named `EnumSchemaNode`.
465
451
  *
@@ -471,11 +457,7 @@ type Props$1 = {
471
457
  * The emitted `File.Source` nodes carry the resolved names so that the barrel
472
458
  * index picks up the correct export identifiers.
473
459
  */
474
- declare function Enum({
475
- node,
476
- enum: enumOptions,
477
- resolver
478
- }: Props$1): KubbReactNode;
460
+ declare function Enum({ node, enum: enumOptions, resolver }: Props$1): KubbReactNode;
479
461
  //#endregion
480
462
  //#region src/components/Type.d.ts
481
463
  type Props = {
@@ -489,13 +471,7 @@ type Props = {
489
471
  enum: PluginTs['resolvedOptions']['enum'];
490
472
  resolver: ResolverTs;
491
473
  };
492
- declare function Type({
493
- name,
494
- node,
495
- printer,
496
- enum: enumOptions,
497
- resolver
498
- }: Props): KubbReactNode;
474
+ declare function Type({ name, node, printer, enum: enumOptions, resolver }: Props): KubbReactNode;
499
475
  //#endregion
500
476
  //#region src/generators/typeGenerator.d.ts
501
477
  /**
@@ -972,9 +948,7 @@ type BuildParamsSchemaOptions = {
972
948
  * header), embedding each param's own schema (and JSDoc) directly rather than referencing a
973
949
  * separate per-param type — the group itself is the only type these params get exported as.
974
950
  */
975
- declare function buildParams({
976
- params
977
- }: BuildParamsSchemaOptions): ast.SchemaNode;
951
+ declare function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode;
978
952
  //#endregion
979
953
  export { type CreateOperationParamsOptions, Enum, type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, Type, type TypeExpression, type TypeLiteralNode, buildParams, createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createOperationParams, createTypeLiteral, pluginTs as default, pluginTs, functionPrinter, pluginTsName, printerTs, renderType, resolverTs, typeGenerator };
980
954
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -67,31 +67,6 @@ function screamingSnakeCase(text, { prefix = "", suffix = "" } = {}) {
67
67
  }).toUpperCase();
68
68
  }
69
69
  //#endregion
70
- //#region ../../internals/utils/src/fs.ts
71
- /**
72
- * Builds a nested file path from a dotted name. Splits on dots that precede a letter
73
- * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
74
- * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
75
- *
76
- * Empty segments are dropped before joining. They arise when the name starts with a dot
77
- * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
78
- * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
79
- * absolute path, letting generated files escape the configured output directory.
80
- *
81
- * @example Nested path from a dotted name
82
- * `toFilePath('pet.petId') // 'pet/petId'`
83
- *
84
- * @example PascalCase the final segment
85
- * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
86
- *
87
- * @example Suffix applied to the final segment only
88
- * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
89
- */
90
- function toFilePath(name, caseLast = camelCase) {
91
- const parts = name.split(/\.(?=[a-zA-Z])/);
92
- return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : camelCase(part)).filter(Boolean).join("/");
93
- }
94
- //#endregion
95
70
  //#region ../../internals/utils/src/reserved.ts
96
71
  /**
97
72
  * JavaScript and Java reserved words.
@@ -292,6 +267,31 @@ function jsStringEscape(input) {
292
267
  });
293
268
  }
294
269
  //#endregion
270
+ //#region ../../internals/utils/src/fs.ts
271
+ /**
272
+ * Builds a nested file path from a dotted name. Splits on dots that precede a letter
273
+ * (so version numbers embedded in operationIds like `v2025.0` stay intact), camelCases
274
+ * every earlier segment, applies `caseLast` to the final segment, and joins with `/`.
275
+ *
276
+ * Empty segments are dropped before joining. They arise when the name starts with a dot
277
+ * followed by a letter (e.g. `..Schema` splits into `['..', 'Schema']` and `'..'` cases to
278
+ * an empty string). Without this a leading `/` would form, which `path.resolve` reads as an
279
+ * absolute path, letting generated files escape the configured output directory.
280
+ *
281
+ * @example Nested path from a dotted name
282
+ * `toFilePath('pet.petId') // 'pet/petId'`
283
+ *
284
+ * @example PascalCase the final segment
285
+ * `toFilePath('pet.Pet', pascalCase) // 'pet/Pet'`
286
+ *
287
+ * @example Suffix applied to the final segment only
288
+ * `toFilePath('tag.tag', (part) => camelCase(part, { suffix: 'schema' })) // 'tag/tagSchema'`
289
+ */
290
+ function toFilePath(name, caseLast = camelCase) {
291
+ const parts = name.split(/\.(?=[a-zA-Z])/);
292
+ return parts.map((part, i) => i === parts.length - 1 ? caseLast(part) : camelCase(part)).filter(Boolean).join("/");
293
+ }
294
+ //#endregion
295
295
  //#region src/constants.ts
296
296
  /**
297
297
  * `optionalType` values that cause a property's type to include `| undefined`.
@@ -335,7 +335,6 @@ const PARAM_RANK = {
335
335
  //#endregion
336
336
  //#region src/factory.ts
337
337
  var factory_exports = /* @__PURE__ */ __exportAll({
338
- SyntaxKind: () => SyntaxKind,
339
338
  appendJSDocToNode: () => appendJSDocToNode,
340
339
  buildIndexSignatures: () => buildIndexSignatures,
341
340
  buildMemberNodes: () => buildMemberNodes,
@@ -343,29 +342,15 @@ var factory_exports = /* @__PURE__ */ __exportAll({
343
342
  buildTupleNode: () => buildTupleNode,
344
343
  constToTypeNode: () => constToTypeNode,
345
344
  createArrayDeclaration: () => createArrayDeclaration,
346
- createArrayTypeNode: () => createArrayTypeNode,
347
345
  createEnumDeclaration: () => createEnumDeclaration,
348
346
  createExportDeclaration: () => createExportDeclaration,
349
- createFalse: () => createFalse,
350
- createIdentifier: () => createIdentifier,
351
347
  createImportDeclaration: () => createImportDeclaration,
352
- createIndexSignature: () => createIndexSignature,
353
- createInterfaceDeclaration: () => createInterfaceDeclaration,
354
348
  createIntersectionDeclaration: () => createIntersectionDeclaration,
355
349
  createJSDoc: () => createJSDoc,
356
- createLiteralTypeNode: () => createLiteralTypeNode,
357
- createNumericLiteral: () => createNumericLiteral,
358
350
  createOmitDeclaration: () => createOmitDeclaration,
359
- createOptionalTypeNode: () => createOptionalTypeNode,
360
351
  createParameterSignature: () => createParameterSignature,
361
- createPrefixUnaryExpression: () => createPrefixUnaryExpression,
362
352
  createPropertySignature: () => createPropertySignature,
363
353
  createQuestionToken: () => createQuestionToken,
364
- createRestTypeNode: () => createRestTypeNode,
365
- createStringLiteral: () => createStringLiteral,
366
- createTrue: () => createTrue,
367
- createTupleTypeNode: () => createTupleTypeNode,
368
- createTypeAliasDeclaration: () => createTypeAliasDeclaration,
369
354
  createTypeDeclaration: () => createTypeDeclaration,
370
355
  createTypeLiteralNode: () => createTypeLiteralNode,
371
356
  createTypeReferenceNode: () => createTypeReferenceNode,
@@ -1023,22 +1008,93 @@ function getOperationParameters(node, options = {}) {
1023
1008
  };
1024
1009
  }
1025
1010
  //#endregion
1026
- //#region ../../internals/shared/src/adapter.ts
1011
+ //#region ../../internals/shared/src/resolver.ts
1027
1012
  /**
1028
- * Narrows the generic `Adapter` from a generator context to the OpenAPI adapter,
1029
- * so OAS-only options (`dateType`, `nameMapping`) and the parsed `document` are typed.
1013
+ * Resolves a single operation parameter name with the
1014
+ * `<operationId> <in> <name>` template.
1030
1015
  *
1031
- * Throws when a non-OAS adapter is configured, turning a silently wrong cast into a
1032
- * clear, actionable error at the point of use.
1016
+ * @example
1017
+ * `operationParamName.call(resolver, node, param) // → 'DeletePetPathPetId'`
1018
+ */
1019
+ function operationParamName(node, param) {
1020
+ return this.name(`${node.operationId} ${param.in} ${param.name}`);
1021
+ }
1022
+ /**
1023
+ * Builds the shared `param` namespace. Spread the result into `createResolver`
1024
+ * and override individual methods next to it when a plugin deviates.
1033
1025
  *
1034
1026
  * @example
1035
1027
  * ```ts
1036
- * const { dateType } = getOasAdapter(ctx.adapter).options
1028
+ * createResolver<PluginTs>({ param: createOperationParamResolver(), ... })
1037
1029
  * ```
1038
1030
  */
1039
- function getOasAdapter(adapter) {
1040
- if (adapter.name !== "oas") throw new Error(`Expected the OpenAPI adapter (adapterOas), but received "${adapter.name}". Configure \`adapter: adapterOas()\` in your Kubb config.`);
1041
- return adapter;
1031
+ function createOperationParamResolver() {
1032
+ return {
1033
+ name: operationParamName,
1034
+ path(node) {
1035
+ return this.name(`${node.operationId} Path`);
1036
+ },
1037
+ query(node) {
1038
+ return this.name(`${node.operationId} Query`);
1039
+ },
1040
+ headers(node) {
1041
+ return this.name(`${node.operationId} Headers`);
1042
+ }
1043
+ };
1044
+ }
1045
+ /**
1046
+ * Builds the shared `response` namespace. Spread the result into
1047
+ * `createResolver` and add plugin-specific methods (`options`, `error`) next
1048
+ * to it.
1049
+ *
1050
+ * @example
1051
+ * ```ts
1052
+ * createResolver<PluginTs>({ response: { ...createOperationResponseResolver(), options(node) {...} }, ... })
1053
+ * ```
1054
+ */
1055
+ function createOperationResponseResolver() {
1056
+ return {
1057
+ status(node, statusCode) {
1058
+ return this.name(`${node.operationId} Status ${statusCode}`);
1059
+ },
1060
+ body(node) {
1061
+ return this.name(`${node.operationId} Body`);
1062
+ },
1063
+ responses(node) {
1064
+ return this.name(`${node.operationId} Responses`);
1065
+ },
1066
+ response(node) {
1067
+ return this.name(`${node.operationId} Response`);
1068
+ }
1069
+ };
1070
+ }
1071
+ /**
1072
+ * Builds a resolver `file` override whose base name runs every path segment
1073
+ * through `toFilePath`, casing the final segment with `caseLast`.
1074
+ *
1075
+ * @example
1076
+ * ```ts
1077
+ * createResolver<PluginTs>({ file: createCasedFile(pascalCase), ... })
1078
+ * ```
1079
+ */
1080
+ function createCasedFile(caseLast) {
1081
+ return { baseName({ name, extname }) {
1082
+ return `${toFilePath(name, caseLast)}${extname}`;
1083
+ } };
1084
+ }
1085
+ //#endregion
1086
+ //#region ../../internals/shared/src/refs.ts
1087
+ /**
1088
+ * Collects the resolved target name of every pointer-carrying ref in a schema tree, in
1089
+ * first-occurrence order. Use this for name-only checks (e.g. redeclaration detection) where
1090
+ * `resolver.imports` would resolve file paths that are then discarded.
1091
+ */
1092
+ function collectRefNames(schema) {
1093
+ return ast.collect(schema, { schema: (node) => {
1094
+ const refNode = ast.narrowSchema(node, "ref");
1095
+ if (!refNode?.ref) return null;
1096
+ return ast.resolveRefName(refNode);
1097
+ } });
1042
1098
  }
1043
1099
  //#endregion
1044
1100
  //#region ../../internals/shared/src/group.ts
@@ -1095,6 +1151,10 @@ function isInlineConstEnum(node, enumSchemaNames) {
1095
1151
  function isSchemaOptional(schema) {
1096
1152
  return Boolean("optional" in schema && schema.optional || "nullish" in schema && schema.nullish);
1097
1153
  }
1154
+ function formatExample(value) {
1155
+ if (value === null || typeof value !== "object") return String(value);
1156
+ return (JSON.stringify(value) ?? String(value)).replaceAll("*/", "*\\/");
1157
+ }
1098
1158
  function buildPropertyJSDocComments(schema, optional) {
1099
1159
  const meta = ast.syncSchemaRef(schema);
1100
1160
  const isArray = meta?.primitive === "array";
@@ -1109,7 +1169,7 @@ function buildPropertyJSDocComments(schema, optional) {
1109
1169
  !isArray && meta && "max" in meta && meta.max !== void 0 ? `@maxLength ${meta.max}` : null,
1110
1170
  meta && "pattern" in meta && meta.pattern ? `@pattern ${meta.pattern}` : null,
1111
1171
  meta && "default" in meta && meta.default !== void 0 ? `@default ${"primitive" in meta && meta.primitive === "string" && typeof meta.default === "string" ? stringify(meta.default) : meta.default}` : null,
1112
- ...exampleValues.map((example) => `@example ${example}`),
1172
+ ...exampleValues.map((example) => `@example ${formatExample(example)}`),
1113
1173
  meta && "primitive" in meta && meta.primitive ? [`@type ${meta.primitive}`, optional ?? isSchemaOptional(schema) ? " | undefined" : null].filter(Boolean).join("") : null
1114
1174
  ].filter(Boolean);
1115
1175
  }
@@ -1340,8 +1400,10 @@ const printerTs = ast.createPrinter((options) => {
1340
1400
  time: dateOrStringNode,
1341
1401
  ref(node) {
1342
1402
  if (!node.name) return null;
1343
- const refName = node.ref ? this.options.nameMapping?.get(node.ref) ?? ast.extractRefName(node.ref) ?? node.name : node.name;
1344
- return createTypeReferenceNode(node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix && this.options.enumSchemaNames?.has(refName) ? this.options.resolver.enum.keyName({ name: refName }, this.options.enum.typeSuffix) : node.ref ? this.options.resolver.name(refName) : refName, void 0);
1403
+ const refName = ast.resolveRefName(node);
1404
+ if (!refName) return null;
1405
+ const name = node.ref && ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix && this.options.enumSchemaNames?.has(refName) ? this.options.resolver.enum.keyName({ name: refName }, this.options.enum.typeSuffix) : node.ref ? this.options.resolver.name(refName) : refName;
1406
+ return createTypeReferenceNode(name, void 0);
1345
1407
  },
1346
1408
  enum(node) {
1347
1409
  const values = node.namedEnumValues?.map((v) => v.value) ?? node.enumValues ?? [];
@@ -1349,7 +1411,8 @@ const printerTs = ast.createPrinter((options) => {
1349
1411
  withParentheses: true,
1350
1412
  nodes: values.filter((v) => v !== null && v !== void 0).map((value) => constToTypeNode(value, typeof value)).filter(isNonNullable)
1351
1413
  }) ?? void 0;
1352
- return createTypeReferenceNode(ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix ? this.options.resolver.enum.keyName(node, this.options.enum.typeSuffix) : this.options.resolver.name(node.name), void 0);
1414
+ const resolvedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enum.type) && this.options.enum.typeSuffix ? this.options.resolver.enum.keyName(node, this.options.enum.typeSuffix) : this.options.resolver.name(node.name);
1415
+ return createTypeReferenceNode(resolvedName, void 0);
1353
1416
  },
1354
1417
  union(node) {
1355
1418
  const members = node.members ?? [];
@@ -1466,24 +1529,22 @@ const typeGenerator = defineGenerator({
1466
1529
  renderer: jsxRenderer,
1467
1530
  schema(node, ctx) {
1468
1531
  const { enum: enumOptions, syntaxType, optionalType, arrayType, output, group, printer } = ctx.options;
1469
- const { adapter, config, resolver, root } = ctx;
1532
+ const { config, resolver, root } = ctx;
1470
1533
  if (!node.name) return;
1471
1534
  const enumSchemaNames = new Set(ctx.meta.enumNames);
1472
- const imports = adapter.getImports(node, (schemaName) => ({
1473
- name: resolveImportName({
1474
- schemaName,
1475
- enumOptions,
1476
- enumSchemaNames,
1477
- resolver
1478
- }),
1479
- path: resolver.file({
1480
- name: schemaName,
1481
- extname: ".ts",
1482
- root,
1483
- output,
1484
- group: group ?? void 0
1485
- }).path
1486
- }));
1535
+ const importName = (schemaName) => resolveImportName({
1536
+ schemaName,
1537
+ enumOptions,
1538
+ enumSchemaNames,
1539
+ resolver
1540
+ });
1541
+ const imports = resolver.imports({
1542
+ node,
1543
+ root,
1544
+ output,
1545
+ group: group ?? void 0,
1546
+ name: importName
1547
+ });
1487
1548
  const enumNode = ast.narrowSchema(node, ast.schemaTypes.enum);
1488
1549
  const isEnumSchema = !!enumNode && !isInlineConstEnum(enumNode, enumSchemaNames);
1489
1550
  const meta = {
@@ -1505,7 +1566,6 @@ const typeGenerator = defineGenerator({
1505
1566
  description: node.description,
1506
1567
  resolver,
1507
1568
  enumSchemaNames,
1508
- nameMapping: getOasAdapter(adapter).options.nameMapping,
1509
1569
  nodes: printer?.nodes
1510
1570
  });
1511
1571
  return /* @__PURE__ */ jsxs(File, {
@@ -1548,7 +1608,7 @@ const typeGenerator = defineGenerator({
1548
1608
  },
1549
1609
  operation(node, ctx) {
1550
1610
  const { enum: enumOptions, optionalType, arrayType, syntaxType, group, output, printer } = ctx.options;
1551
- const { adapter, config, resolver, root } = ctx;
1611
+ const { config, resolver, root } = ctx;
1552
1612
  const params = caseParams(node.parameters, "camelcase");
1553
1613
  const meta = { file: resolver.file({
1554
1614
  name: node.operationId,
@@ -1560,23 +1620,21 @@ const typeGenerator = defineGenerator({
1560
1620
  group: group ?? void 0
1561
1621
  }) };
1562
1622
  const enumSchemaNames = new Set(ctx.meta.enumNames);
1623
+ const importName = (schemaName) => resolveImportName({
1624
+ schemaName,
1625
+ enumOptions,
1626
+ enumSchemaNames,
1627
+ resolver
1628
+ });
1563
1629
  function renderSchemaType({ schema, name, keysToOmit }) {
1564
1630
  if (!schema) return null;
1565
- const imports = adapter.getImports(schema, (schemaName) => ({
1566
- name: resolveImportName({
1567
- schemaName,
1568
- enumOptions,
1569
- enumSchemaNames,
1570
- resolver
1571
- }),
1572
- path: resolver.file({
1573
- name: schemaName,
1574
- extname: ".ts",
1575
- root,
1576
- output,
1577
- group: group ?? void 0
1578
- }).path
1579
- }));
1631
+ const imports = resolver.imports({
1632
+ node: schema,
1633
+ root,
1634
+ output,
1635
+ group: group ?? void 0,
1636
+ name: importName
1637
+ });
1580
1638
  const schemaPrinter = printerTs({
1581
1639
  optionalType,
1582
1640
  arrayType,
@@ -1587,7 +1645,6 @@ const typeGenerator = defineGenerator({
1587
1645
  keysToOmit,
1588
1646
  resolver,
1589
1647
  enumSchemaNames,
1590
- nameMapping: getOasAdapter(adapter).options.nameMapping,
1591
1648
  nodes: printer?.nodes
1592
1649
  });
1593
1650
  return /* @__PURE__ */ jsxs(Fragment, { children: [imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
@@ -1696,15 +1753,7 @@ const typeGenerator = defineGenerator({
1696
1753
  if (!node.responses.some(hasSchema)) return null;
1697
1754
  const responseName = resolver.response.response(node);
1698
1755
  const responsesWithSchema = node.responses.filter(hasSchema);
1699
- if (new Set(responsesWithSchema.flatMap((res) => (res.content ?? []).flatMap((entry) => entry.schema ? adapter.getImports(entry.schema, (schemaName) => ({
1700
- name: resolveImportName({
1701
- schemaName,
1702
- enumOptions,
1703
- enumSchemaNames,
1704
- resolver
1705
- }),
1706
- path: ""
1707
- })).flatMap((imp) => Array.isArray(imp.name) ? imp.name : [imp.name]) : []))).has(responseName)) return null;
1756
+ if (new Set(responsesWithSchema.flatMap((res) => (res.content ?? []).flatMap((entry) => entry.schema ? collectRefNames(entry.schema).map(importName) : []))).has(responseName)) return null;
1708
1757
  return renderSchemaType({
1709
1758
  schema: {
1710
1759
  ...buildResponseUnion(node, { resolver }),
@@ -1771,38 +1820,12 @@ const resolverTs = createResolver({
1771
1820
  name(name) {
1772
1821
  return ensureValidVarName(pascalCase(name));
1773
1822
  },
1774
- file: { baseName({ name, extname }) {
1775
- return `${toFilePath(name, pascalCase)}${extname}`;
1776
- } },
1777
- param: {
1778
- name(node, param) {
1779
- return this.name(`${node.operationId} ${param.in} ${param.name}`);
1780
- },
1781
- path(node) {
1782
- return this.name(`${node.operationId} Path`);
1783
- },
1784
- query(node) {
1785
- return this.name(`${node.operationId} Query`);
1786
- },
1787
- headers(node) {
1788
- return this.name(`${node.operationId} Headers`);
1789
- }
1790
- },
1823
+ file: createCasedFile(pascalCase),
1824
+ param: createOperationParamResolver(),
1791
1825
  response: {
1792
- status(node, statusCode) {
1793
- return this.name(`${node.operationId} Status ${statusCode}`);
1794
- },
1826
+ ...createOperationResponseResolver(),
1795
1827
  options(node) {
1796
1828
  return this.name(`${node.operationId} Options`);
1797
- },
1798
- responses(node) {
1799
- return this.name(`${node.operationId} Responses`);
1800
- },
1801
- response(node) {
1802
- return this.name(`${node.operationId} Response`);
1803
- },
1804
- body(node) {
1805
- return this.name(`${node.operationId} Body`);
1806
1829
  }
1807
1830
  },
1808
1831
  enum: { keyName(node, enumTypeSuffix = "key") {