Strip optional route scope prefix when selecting and naming API routes - #22
Merged
Merged
Conversation
edvardas-samesystem
requested review from
ValdemarKobelis,
povilasjurcys and
same-dovydas
July 16, 2026 07:21
ValdemarKobelis
approved these changes
Jul 20, 2026
edvardas-samesystem
force-pushed
the
fix/strip-optional-scope-prefix
branch
3 times, most recently
from
July 20, 2026 07:47
f87f37f to
80201ed
Compare
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.
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.