From 6a39117e2efca9542f9c68366c94f7bb0281891c Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 1 Jun 2026 21:28:44 +0800 Subject: [PATCH] fix: sanitize path segments in OpenAPI customFunctionName fallback Replace `{`, `}`, and `-` characters with underscores before building function names from path segments. This prevents invalid identifiers when the OpenAPI path contains parameters like `{id}` or kebab-case segments. Co-Authored-By: Claude Opus 4.7 --- config/config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/config.ts b/config/config.ts index 280405a0..ec01b259 100644 --- a/config/config.ts +++ b/config/config.ts @@ -222,7 +222,11 @@ export default defineConfig({ ); } const method = data.method || 'get'; - const segments = (data.path || '').split('/').filter(Boolean); + // Remove path parameters (e.g. {id}), hyphens, and other non-alphanumeric chars + const segments = (data.path || '') + .replace(/[{}-]/g, '_') + .split('/') + .filter(Boolean); const name = method + segments