Skip to content

Strip optional route scope prefix when selecting and naming API routes - #22

Merged
matas-zanevicius merged 1 commit into
mainfrom
fix/strip-optional-scope-prefix
Jul 20, 2026
Merged

Strip optional route scope prefix when selecting and naming API routes#22
matas-zanevicius merged 1 commit into
mainfrom
fix/strip-optional-scope-prefix

Conversation

@edvardas-samesystem

@edvardas-samesystem edvardas-samesystem commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Currently, route selection and path naming assume route specs start with a bare /api prefix. When a host app wraps its routes in an optional scope, e.g. scope '(:locale)' or scope '(:tenant)', every route spec gets prefixed: (/:locale)/api/v1/users(.:format). The anchored matching stops working and the generated openapi.json ends up with no paths at all.

This PR strips a leading optional scope segment from the route spec before selecting and naming routes, so scoped apps generate the same openapi.json as unscoped ones.

Backward compatible: unscoped specs start with /, the regex is a no-op, and the existing dump-parity spec passes unchanged. A regression spec covers the scoped case.

@edvardas-samesystem
edvardas-samesystem force-pushed the fix/strip-optional-scope-prefix branch 3 times, most recently from f87f37f to 80201ed Compare July 20, 2026 07:47
@matas-zanevicius
matas-zanevicius merged commit cc50ce8 into main Jul 20, 2026
5 of 17 checks passed
@matas-zanevicius
matas-zanevicius deleted the fix/strip-optional-scope-prefix branch July 20, 2026 08:00
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.

3 participants