feat: Uri parameters in vars expression#142
Draft
boekkooi-lengoo wants to merge 9 commits intoapi7:masterfrom
Draft
feat: Uri parameters in vars expression#142boekkooi-lengoo wants to merge 9 commits intoapi7:masterfrom
boekkooi-lengoo wants to merge 9 commits intoapi7:masterfrom
Conversation
This will allow us to use the matched params as part of the vars later.
This adds `uri_param_<name>` allowing vars and filters access to the parameters of a uri. By doing this we are able to improve validation of routes to specific params.
As match_route_opts now handles both the opts and params we can set the matched information in match_route_opts to avoid some duplicate code.
It seems `setmetatable` is very slow and was destroying the benchmark. For this reason we now use `clone_tab` and add the uri matches.
No need to capture this data.
There is no need to return `nil` as this is the default so let's avoid adding it.
Contributor
|
@boekkooi-lengoo I have helped you to rerun the CI, the test cases had passed. You can continue this PR |
Contributor
Author
|
Hey @membphis Could you maybe review the code and let me know if it requires some changes before I write the docs? Thanks in advance! |
Contributor
|
will do this tomorrow |
Contributor
|
sorry for my late reply, it take me more time to read and test your code, they are all fine to me |
membphis
reviewed
Jan 23, 2024
[table.clone](https://github.com/openresty/luajit2#tableclone) won't copy metamethods. So in order to avoid any issues the [__index](https://www.lua.org/pil/13.4.1.html) metamethod is added to the new ops_vars.
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.
This PR is a spin-off from #141 as the implementation differs a lot but causes the same effect.