Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order routes by specificity #8

Open
WilliamRagstad opened this issue Aug 23, 2024 · 0 comments
Open

Order routes by specificity #8

WilliamRagstad opened this issue Aug 23, 2024 · 0 comments
Labels
enhancement 🎨 Improvements or minor features good first issue ⭐ Good for newcomers

Comments

@WilliamRagstad
Copy link
Member

Currently, routes get the same order in execution as in the source code or are completely random.
This is not a desired behavior, as one may define a "catch-all" route that takes precedence over a direct one. See example below:

GET /path/(anything: String)/here -> ...
GET /path/to/here -> ...

In the above example, we see that the first route takes a generic URL parameter anything: String, which will capture the segment to if requesting /path/to/here.

Solution

Order the routes by path specificity using a novel algorithm to ensure optimal resource coverage. Display a warning when one or more route paths collide or become ambiguous.

@WilliamRagstad WilliamRagstad added enhancement 🎨 Improvements or minor features good first issue ⭐ Good for newcomers labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎨 Improvements or minor features good first issue ⭐ Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant