Skip to content

fix: an interaction matches a path the spec writes with a trailing slash - #84

Merged
MarkRosemaker merged 1 commit into
mainfrom
fix/trailing-slash-match
Nov 24, 2026
Merged

MarkRosemaker merged 1 commit into
mainfrom
fix/trailing-slash-match

Conversation

@MarkRosemaker

Copy link
Copy Markdown
Owner

go-api-libs/yahoo-finance's make ready fails on its new, real interaction:

openapi-codegen: matching interactions: interaction GET https://query2.finance.yahoo.com/v7/finance/options/ONDS?crumb=…&date=1799366400: no matching operation found

The spec writes the path as /v7/finance/options/{ticker}/. The generated client builds its URL with url.JoinPath, which drops a trailing slash unless its last argument ends in one, and the generated arguments never do. So the client calls /v7/finance/options/ONDS, and that's what was recorded; Yahoo answered 200. The matcher split the template into one segment more than the path and rejected it.

matchPathTemplate now drops a trailing slash on both sides before splitting, as the client does. TestMatchPathTemplate gains both cases: a spec path with the slash against a recording without, and the other way round. Both fail without the fix: no match, and ticker read as ONDS/.

Checked against yahoo-finance: with this generator, its go generate and tests pass, and the new interaction replays. make ready passes here.


Generated by Claude Code

The generated client builds its URL with url.JoinPath, which drops a trailing
slash, so a spec path such as /v7/finance/options/{ticker}/ is called as
/v7/finance/options/ONDS. The matcher split the template into one segment
more and found no operation for the recording. It now drops a trailing slash
on both sides, as the client does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
@MarkRosemaker
MarkRosemaker merged commit 5fc9048 into main Nov 24, 2026
1 check passed
@MarkRosemaker
MarkRosemaker deleted the fix/trailing-slash-match branch November 24, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants