echo
echo copied to clipboard
[issue-2557] Add :from-:to range route formats
Implements this feature (https://github.com/labstack/echo/issues/2557)
Adds :from-:to route.
example /flights/:from-:to
This is little bit too simple take for implementing this feature. I would say that the requirement we are talking is allowing multiple parameters per route segment where segment is string part between / (slashes). Searching for param end to be / or - is little bit too restricted. Probably using syntax "/{month}-{day}-{year}" like Chi uses would be better.
p.s. using new special characters in route paths like { and } (or whatever character pair is selected) potentially breaks small number of users applications.
@aldas Thank you for your comment.
the / delimiter was already present and I don't think we should change that.
If I understood correctly, the restriction here is that users cannot use - in a parameter name like :user-name. Is that correct?
If I understood correctly, the restriction here is that users cannot use - in a parameter name like :user-name. Is that correct?
No, using only - is too restricting.
the
/delimiter was already present and I don't think we should change that.
Sorry, I did not word this clearly. What I meant is that in addition to :param we could support {param} syntax and in that case we can have anything between two params like {file}.{ext}. As long there is something between that we can distinguish as separator.
@aldas
Hi @aldas , I am just following up on this PR to see if there are any further changes to be made. Thank you for your time!
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
584cb85) 92.89% compared to head (d2b378c) 92.90%. Report is 4 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #2560 +/- ##
==========================================
+ Coverage 92.89% 92.90% +0.01%
==========================================
Files 39 39
Lines 4658 4668 +10
==========================================
+ Hits 4327 4337 +10
Misses 240 240
Partials 91 91
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@aldas Thank you for triggering the code coverage action. Looking forward to further updates on this PR.
@aldas Hi, can this PR be merged? The {} placeholder format is very good. Some frameworks in other languages also use this approach For example: https://laravel.com/docs/11.x/routing#required-parameters