Order routes by specificity
Opened this issue · 0 comments
WilliamRagstad commented
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.