From ef1c92112d43ea7085da6dd996983fedf66c8812 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 01:17:01 +0000 Subject: [PATCH 1/3] Initial plan From 27a20eccd7e60c12e7b5e162e1765f4033ca5bf8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 01:23:29 +0000 Subject: [PATCH 2/3] Refactor route parameter naming and fix TypeScript errors - Rename routeInfoByMethodsMap to routesByMethod for clarity - Rename originalRouteName to rawRoute for better readability - Add type validation before paramName.includes() to prevent runtime errors - Add type validation before lodash.camelCase(paramName) to prevent runtime errors - Fix getContentTypes() call to pass required 2 arguments instead of 1 Co-authored-by: smorimoto <38746192+smorimoto@users.noreply.github.com> --- src/schema-routes/schema-routes.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/schema-routes/schema-routes.ts b/src/schema-routes/schema-routes.ts index f339cfa0..26f2c5c4 100644 --- a/src/schema-routes/schema-routes.ts +++ b/src/schema-routes/schema-routes.ts @@ -65,11 +65,11 @@ export class SchemaRoutes { ]); } - createRequestsMap = (routeInfoByMethodsMap) => { - const parameters = lodash.get(routeInfoByMethodsMap, "parameters"); + createRequestsMap = (routesByMethod) => { + const parameters = lodash.get(routesByMethod, "parameters"); return lodash.reduce( - routeInfoByMethodsMap, + routesByMethod, (acc, requestInfo, method) => { if ( method.startsWith("x-") || @@ -91,10 +91,10 @@ export class SchemaRoutes { ); }; - parseRouteName = (originalRouteName) => { + parseRouteName = (rawRoute) => { const routeName = - this.config.hooks.onPreBuildRoutePath(originalRouteName) || - originalRouteName; + this.config.hooks.onPreBuildRoutePath(rawRoute) || + rawRoute; // TODO forbid leading symbols [\]^` in a major release (allowed yet for backwards compatibility) const pathParamMatches = (routeName || "").match( @@ -157,15 +157,13 @@ export class SchemaRoutes { ); for (const paramName of paramNames) { - // @ts-expect-error TS(2339) FIXME: Property 'includes' does not exist on type 'unknow... Remove this comment to see the full error message - if (paramName.includes("-")) { + if (typeof paramName === "string" && paramName.includes("-")) { consola.warn("wrong query param name", paramName); } queryParams.push({ $match: paramName, - // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message - name: lodash.camelCase(paramName), + name: typeof paramName === "string" ? lodash.camelCase(paramName) : lodash.camelCase(String(paramName)), required: true, type: "string", description: "", @@ -178,7 +176,7 @@ export class SchemaRoutes { } const result = { - originalRoute: originalRouteName || "", + originalRoute: rawRoute || "", route: fixedRoute, pathParams, queryParams, @@ -416,8 +414,7 @@ export class SchemaRoutes { lodash.reduce( requestInfos, (acc, requestInfo, status) => { - // @ts-expect-error TS(2554) FIXME: Expected 2 arguments, but got 1. - const contentTypes = this.getContentTypes([requestInfo]); + const contentTypes = this.getContentTypes([requestInfo], operationId); return [ ...acc, From 1406d6de883d18ac3eeb3f9ad150b4be1113ce3f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 30 Oct 2025 01:32:24 +0000 Subject: [PATCH 3/3] Apply biome formatting fixes Co-authored-by: smorimoto <38746192+smorimoto@users.noreply.github.com> --- src/schema-routes/schema-routes.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/schema-routes/schema-routes.ts b/src/schema-routes/schema-routes.ts index 26f2c5c4..0d64813f 100644 --- a/src/schema-routes/schema-routes.ts +++ b/src/schema-routes/schema-routes.ts @@ -93,8 +93,7 @@ export class SchemaRoutes { parseRouteName = (rawRoute) => { const routeName = - this.config.hooks.onPreBuildRoutePath(rawRoute) || - rawRoute; + this.config.hooks.onPreBuildRoutePath(rawRoute) || rawRoute; // TODO forbid leading symbols [\]^` in a major release (allowed yet for backwards compatibility) const pathParamMatches = (routeName || "").match( @@ -163,7 +162,10 @@ export class SchemaRoutes { queryParams.push({ $match: paramName, - name: typeof paramName === "string" ? lodash.camelCase(paramName) : lodash.camelCase(String(paramName)), + name: + typeof paramName === "string" + ? lodash.camelCase(paramName) + : lodash.camelCase(String(paramName)), required: true, type: "string", description: "",