René's URL Explorer Experiment


Title: feat(adapters): raise on ambiguous api_path instead of guessing by mortik · Pull Request #49 · openapi-ruby/openapi-ruby · GitHub

Open Graph Title: feat(adapters): raise on ambiguous api_path instead of guessing by mortik · Pull Request #49 · openapi-ruby/openapi-ruby

X Title: feat(adapters): raise on ambiguous api_path instead of guessing by mortik · Pull Request #49 · openapi-ruby/openapi-ruby

Description: Third in the series after #45 and #47. Same theme: Style 2's convenience shouldn't cost correctness. Problem Style 2 separates the api_path declaration from the request that exercises it, so assert_api_response has to match the request back to a declaration. The only discriminators are the verb and whether any path params were supplied: if has_path_params ctx.path_template.include?("{") # first context with a brace wins else !ctx.path_template.include?("{") end That is enough for the shape it was designed for — one resource per class, a collection path plus a member path, which is how the dummy app and most suites use it. It is not enough beyond that: api_path "/timers/{id}" { put("Update") { ... } } api_path "/timers/{id}/start" { put("Start") { ... } } api_path "/timers/{id}/stop" { put("Stop") { ... } } All three match "PUT with a path param". The finder returns whichever was declared first, so the request goes to the wrong endpoint and is validated against the wrong operation's response schema. The test then passes or fails for reasons unrelated to what it claims to cover. /users vs /users/current collides the same way with no params at all. I hit this four times porting a real API onto Style 2 — the clearest case being a "starts a timer" test that was quietly exercising update. Note the paths themselves are perfectly distinct; start and stop are literal segments. The matcher just discards the template apart from the brace check. Fix AmbiguousApiPath when more than one context matches, naming the candidates: PUT matches more than one api_path in TimersTest: "/timers/{id}", "/timers/{id}/start". Requests are matched on the verb and whether path params were given, which cannot tell these apart. Declare each api_path in its own class. This only fires where resolution was already wrong — if it was unambiguous before, it stays unambiguous — so nothing that currently works starts failing. Both adapters carried the same matcher; they now share one ContextResolution module. Optional enforcement config.single_api_path_per_class makes api_path raise MultipleApiPaths as soon as a class declares a second path, so the convention is caught at declaration rather than at the first ambiguous request. Off in 4.x, where a second declaration warns instead. Turning it on by default now would break existing suites on a patch release — including this gem's own dummy app, and FleetYards' docks_test.rb. The warning names 5.0 as the version where it becomes the default, which gives consumers a release to split their classes in. Verification Specs written first, then the raise reverted to confirm they catch the original behaviour — 2 failures, both the ambiguous cases. With the fix: 331 examples, 0 failures, standardrb clean. Coverage includes the non-breaking direction: collection-plus-member still resolves, a verb that only one context declares still resolves, and a second api_path with enforcement off still works and only warns. 🤖

Open Graph Description: Third in the series after #45 and #47. Same theme: Style 2's convenience shouldn't cost correctness. Problem Style 2 separates the api_path declaration from the request that exercises it, s...

X Description: Third in the series after #45 and #47. Same theme: Style 2's convenience shouldn't cost correctness. Problem Style 2 separates the api_path declaration from the request that exercis...

Opengraph URL: https://github.com/openapi-ruby/openapi-ruby/pull/49

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:5ed9d08d-c3e3-d808-2925-6c2c47acfbeb
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA67C:29FFA9:1AC39B1:21E22A1:6B014B7F
html-safe-nonce4dda8f87e0ee655f6ef6a7f7d09ba4cfd7dcf71c6271b1cdac44546ae279db30
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjdDOjI5RkZBOToxQUMzOUIxOjIxRTIyQTE6NkIwMTRCN0YiLCJ2aXNpdG9yX2lkIjoiNjc0NzM1MzEyNjU2NDYxMjk5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac51634a07122feb0f1e22a99948f153afa6f90c7caacf60f7c63f7d17e80966d7
hovercard-subject-tagpull_request:4246228138
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/openapi-ruby/openapi-ruby/pull/49/files
twitter:imagehttps://avatars.githubusercontent.com/u/517703?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/517703?s=400&v=4
og:image:altThird in the series after #45 and #47. Same theme: Style 2's convenience shouldn't cost correctness. Problem Style 2 separates the api_path declaration from the request that exercises it, s...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/openapi-ruby/openapi-ruby git https://github.com/openapi-ruby/openapi-ruby.git
octolytics-dimension-user_id276587259
octolytics-dimension-user_loginopenapi-ruby
octolytics-dimension-repository_id1211860664
octolytics-dimension-repository_nwoopenapi-ruby/openapi-ruby
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1211860664
octolytics-dimension-repository_network_root_nwoopenapi-ruby/openapi-ruby
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenapi-ruby%2Fopenapi-ruby%2Fpull%2F49%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenapi-ruby%2Fopenapi-ruby%2Fpull%2F49%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=openapi-ruby%2Fopenapi-ruby
Reloadhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
Reloadhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
Reloadhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
openapi-rubyhttps://github.com/openapi-ruby
openapi-rubyhttps://github.com/openapi-ruby/openapi-ruby
Codehttps://github.com/openapi-ruby/openapi-ruby
Issues1 (1)https://github.com/openapi-ruby/openapi-ruby/issues
Pull requests2 (2)https://github.com/openapi-ruby/openapi-ruby/pulls
Actionshttps://github.com/openapi-ruby/openapi-ruby/actions
Projectshttps://github.com/openapi-ruby/openapi-ruby/projects
Security and qualityhttps://github.com/openapi-ruby/openapi-ruby/security
Insightshttps://github.com/openapi-ruby/openapi-ruby/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fopenapi-ruby%2Fopenapi-ruby%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fopenapi-ruby%2Fopenapi-ruby%2Fissues%2Fnew%2Fchoose
mortikhttps://github.com/mortik
mainhttps://github.com/openapi-ruby/openapi-ruby/tree/main
fix/single-api-path-per-classhttps://github.com/openapi-ruby/openapi-ruby/tree/fix/single-api-path-per-class
Conversation 0 https://github.com/openapi-ruby/openapi-ruby/pull/49
Commits 5 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits
Checks 12 https://github.com/openapi-ruby/openapi-ruby/pull/49/checks
Files changed https://github.com/openapi-ruby/openapi-ruby/pull/49/files
Please reload this pagehttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
feat(adapters): raise on ambiguous api_path instead of guessing https://github.com/openapi-ruby/openapi-ruby/pull/49/files#top
Show all changes 5 commits https://github.com/openapi-ruby/openapi-ruby/pull/49/files
0bc8cfa feat(adapters): raise on ambiguous api_path instead of guessing mortik Aug 10, 2026 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits/0bc8cfaec8bc7d097cdeb25f3b7ed4d0365ad22e
8718ccb style: satisfy standardrb in the new spec mortik Aug 10, 2026 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits/8718ccbd9fe131d5d99a54c5b939423c37a5ccac
cb94b8c fix(rspec): scope api_path to the example group that declares it mortik Aug 10, 2026 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits/cb94b8cd7b10219ac5329a2e3daba4415302b440
5055499 fix(adapters): resolve api_path on request facts instead of first match mortik Aug 10, 2026 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits/5055499b102d818a2249b280ed989800eb26543e
f290c79 fix(minitest): drop the deprecation warning on a second api_path mortik Aug 10, 2026 https://github.com/openapi-ruby/openapi-ruby/pull/49/commits/f290c796b49061ed6d3e9b3c8773c85564aaf0cb
Clear filters https://github.com/openapi-ruby/openapi-ruby/pull/49/files
Please reload this pagehttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
Please reload this pagehttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
README.md https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
context_resolution.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-946cc162c8dc7ee71b2ff0fdb6cafdfd5e75450c897554c1f1c0f14582df0aa7
minitest.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
rspec.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
configuration.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
errors.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-1269e14b07c92273c9c9780ab8647a10b9466df71ed8ce059a9d230f2c2541f4
api_path_scoping_spec.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a4a3d631ef6eb607af9f6a61980aef290cf049d8ece84935236eacf9afdaf8c2
context_resolution_spec.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-2d785e7a6d5055ffb1341d0902c159b6fe350ea237348b1cdb156d6271b11bfb
single_api_path_spec.rb https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-9027df3cda0e7c8a279bdbe3ec601ae1965610b894dcbde263852b9611279e7c
README.mdhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/README.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5
lib/openapi_ruby/adapters/context_resolution.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-946cc162c8dc7ee71b2ff0fdb6cafdfd5e75450c897554c1f1c0f14582df0aa7
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/lib/openapi_ruby/adapters/context_resolution.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
lib/openapi_ruby/adapters/minitest.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/lib/openapi_ruby/adapters/minitest.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a69bd05e65e498bee92f016ef268b0c31d3d1c1b0308208dc18ea5ecbc2e6132
lib/openapi_ruby/adapters/rspec.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/lib/openapi_ruby/adapters/rspec.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-f2dd2ab5227d2fe984ab6f362171b9f954c536ff4282219755ba3946c7e1c56e
lib/openapi_ruby/configuration.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/lib/openapi_ruby/configuration.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-73d2e8485869281dcc5d0c8e0439a53ff822c63d8494bcafb91f2e93937cebcd
lib/openapi_ruby/errors.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-1269e14b07c92273c9c9780ab8647a10b9466df71ed8ce059a9d230f2c2541f4
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/lib/openapi_ruby/errors.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-1269e14b07c92273c9c9780ab8647a10b9466df71ed8ce059a9d230f2c2541f4
https://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-1269e14b07c92273c9c9780ab8647a10b9466df71ed8ce059a9d230f2c2541f4
spec/openapi_ruby/adapters/api_path_scoping_spec.rbhttps://github.com/openapi-ruby/openapi-ruby/pull/49/files#diff-a4a3d631ef6eb607af9f6a61980aef290cf049d8ece84935236eacf9afdaf8c2
View file https://github.com/openapi-ruby/openapi-ruby/blob/f290c796b49061ed6d3e9b3c8773c85564aaf0cb/spec/openapi_ruby/adapters/api_path_scoping_spec.rb
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/openapi-ruby/openapi-ruby/pull/49/{{ revealButtonHref }}
Please reload this pagehttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
Please reload this pagehttps://github.com/openapi-ruby/openapi-ruby/pull/49/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.