-
Notifications
You must be signed in to change notification settings - Fork 141
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
Fixed parameters parsing #237
Fixed parameters parsing #237
Conversation
012fece
to
e3cee28
Compare
1eb5b05
to
f19c081
Compare
8c15bc1
to
d8acc99
Compare
d8acc99
to
f301e14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you run the benchmarks before and after?
It seems there is a regression with the "multi-parametric route" benchmark and an improvement for the "multi-parametric route with regexp", could you take a look? |
Yep, I can explain it. There is a regression for a multi-parameter route because previously two parametric nodes were used to parse paths like that About "multi-parametric route with regexp". It created two different nodes to parse paths like that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Fixed #235 #238
The main problem with multi-parametrical nodes is that we can't easily describe the rules of how should it be parsed. Thanks for @mcollina, he said that if I have an unclear case it should work as the path-to-regexp library does #238 (comment). The path-to-regexp converts the hole path to the regexp, so a multi-parametric path is also parsed as a regex. The main idea of this solution is to convert the multi-parametrical part of the path to the regexp. Seems like it's the only way to make it work properly.
Important point: It doesn't convert the whole path to the regexp (as path-to-regexp does), only the part of the path between two '/' if it contains multiple params or param and static part.
It replaces parameters with (.*?), regex parameters with themselves, the static part is also inserted into the regex.
Examples:
Depends on #243