From 5f20a24287e7a5b7b3e7270e118b18facac038bf Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 26 Jan 2026 01:06:12 +0800 Subject: [PATCH] methodName --- .../src/plugins/@orpc/contract/config.ts | 6 +++--- .../src/plugins/@orpc/contract/plugin.ts | 2 +- .../src/plugins/@orpc/contract/types.d.ts | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@orpc/contract/config.ts b/packages/openapi-ts/src/plugins/@orpc/contract/config.ts index d9baec31e..3123aaefb 100644 --- a/packages/openapi-ts/src/plugins/@orpc/contract/config.ts +++ b/packages/openapi-ts/src/plugins/@orpc/contract/config.ts @@ -29,13 +29,13 @@ function resolveRouter( }, mappers: { object(value) { - value.keyName = context.valueToObject({ + value.methodName = context.valueToObject({ defaultValue: { casing: 'camelCase' }, mappers: { function: (name) => ({ name }), string: (name) => ({ name }), }, - value: value.keyName, + value: value.methodName, }); value.segmentName = context.valueToObject({ defaultValue: { casing: 'camelCase' }, @@ -57,7 +57,7 @@ export const defaultConfig: OrpcContractPlugin['Config'] = { contractNameBuilder: (id: string) => `${id}Contract`, exportFromIndex: false, router: { - keyName: { casing: 'camelCase' }, + methodName: { casing: 'camelCase' }, nesting: 'operationId', nestingDelimiters: /[./]/, segmentName: { casing: 'camelCase' }, diff --git a/packages/openapi-ts/src/plugins/@orpc/contract/plugin.ts b/packages/openapi-ts/src/plugins/@orpc/contract/plugin.ts index 26d640c9b..96c07f1a3 100644 --- a/packages/openapi-ts/src/plugins/@orpc/contract/plugin.ts +++ b/packages/openapi-ts/src/plugins/@orpc/contract/plugin.ts @@ -242,7 +242,7 @@ export const handler: OrpcContractPlugin['Handler'] = ({ plugin }) => { for (let i = 0; i < path.length; i++) { const isLast = i === path.length - 1; const segment = isLast - ? applyNaming(path[i]!, router.keyName) + ? applyNaming(path[i]!, router.methodName) : applyNaming(path[i]!, router.segmentName); if (isLast) { diff --git a/packages/openapi-ts/src/plugins/@orpc/contract/types.d.ts b/packages/openapi-ts/src/plugins/@orpc/contract/types.d.ts index 7f78d6c6e..b9c7c0f9c 100644 --- a/packages/openapi-ts/src/plugins/@orpc/contract/types.d.ts +++ b/packages/openapi-ts/src/plugins/@orpc/contract/types.d.ts @@ -8,11 +8,11 @@ import type { NamingConfig, NamingRule } from '~/utils/naming'; export interface UserRouterConfig { /** - * Customize key names for operations in the router. + * Customize method/key names for operations in the router. * - * Applied to the final segment of the path (the key name). + * Applied to the final segment of the path. */ - keyName?: NamingRule; + methodName?: NamingRule; /** * How to derive nesting structure from operations. * @@ -60,11 +60,11 @@ export interface UserRouterConfig { export interface RouterConfig { /** - * Customize key names for operations in the router. + * Customize method/key names for operations in the router. * - * Applied to the final segment of the path (the key name). + * Applied to the final segment of the path. */ - keyName: NamingConfig; + methodName: NamingConfig; /** * How to derive nesting structure from operations. * @@ -133,7 +133,7 @@ export type UserConfig = Plugin.Name<'@orpc/contract'> & * strategy: 'byTags', * nesting: 'operationId', * segmentName: { casing: 'camelCase' }, - * keyName: { casing: 'camelCase' }, + * methodName: { casing: 'camelCase' }, * } */ router?: OperationsStrategy | UserRouterConfig; -- 2.54.0