fix(swagger): normalize kebab-case OpenAPI path params to camelCase - #12
Merged
Merged
Conversation
Swagger-imported handlers whose OpenAPI path used a hyphenated param
(e.g. "{kubeflow-id}") silently never matched real requests: MSW's
path-to-regexp reads a named param token only up to the first
non-word char, so ":kubeflow-id" compiled to param "kubeflow" plus
the literal text "-id", which never appears in a real request path.
No error or warning surfaced anywhere, even with the handler shown
active with a variant selected.
normalizePathParams now sanitizes each captured param name into a
path-to-regexp-safe camelCase identifier before prefixing with ":",
matching this codebase's existing manual-handler convention.
Fixes kakaoenterprise#11
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kep-mei-yo
reviewed
Jul 23, 2026
Change toSafeParamName from camelCase conversion to a single-line
underscore replacement (`{kubeflow-id}` -> `:kubeflow_id`). Simpler
regex, and unlike the camelCase variant it correctly handles leading/
trailing separators (which otherwise left an unsafe character in the
compiled route). Param names are never consumed by identifier
downstream, so matching behavior is unchanged.
Adds snake_case and trailing/leading-separator test cases; updates
ADR-0005 and the workstream docs to record the reversed decision.
Realign markdown tables in ADR INDEX and the release briefing that drifted after the underscore-decision edits.
kep-mei-yo
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
{kubeflow-id},{group-name}) never matched real requests, even when shown as active with a response variant selected in the GUI.What Changed
Root cause
normalizePathParamsconverted{kubeflow-id}verbatim to:kubeflow-id, butpath-to-regexp(used internally by MSW'shttp.<method>()) reads a named parameter token only up to the first non-word character — a hyphen silently truncates it, so the compiled route can never match a real request.match('/v1/kubeflows/:kubeflow-id')('/v1/kubeflows/<uuid>')→false.Fix
normalizePathParamsnow sanitizes each captured brace-param name into a camelCase,path-to-regexp-safe identifier before prefixing with:({kubeflow-id}→:kubeflowId){id},{kubeflowId}) are unaffected.agent-artifacts/decisions/ADR-0005-normalize-kebab-case-path-params.md&agent-artifacts/workstreams/2026-07-16-swagger-hyphen-param-mismatch/implementation notes, and the release briefing.Test plan
pathParams.test.ts: brace→colon conversion, kebab-case→camelCase conversion, multi-param paths, no-op on already-safe nameshttp.delete()handler from the normalized route and runs an actualRequestthroughhandler.run(), reproducing and verifying the fix for the exact symptom reported in [BUG] Swagger/OpenAPI-imported handlers unmatch issue #11vitest run: 73/73 passedtsc --noEmit: cleaneslint .: 0 errors on changed filesbuild: successyalclink into the reporting consumer projectType
Checklist