Browse Source

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 <noreply@anthropic.com>
pull/11839/head
afc163 4 months ago
parent
commit
6a39117e2e
  1. 6
      config/config.ts

6
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

Loading…
Cancel
Save