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

Fix for routes with different parameter names #2903

Merged
merged 4 commits into from
Jun 12, 2024

Conversation

kyri-petrou
Copy link
Collaborator

/fixes #2728
/claim #2728

The solution to the linked issue is when we have multiple segment codecs that match the predicate, to evaluate them all by passing the partial path to their get method, and find the one that returns a result.

In order to avoid adding performance overhead, this evaluation is done only when we determined that we have ambiguities

val matched = matches(index)
if (matched > 0) {
val (_, subtree0) = flattened(index)
val subpath = path.dropLeadingSlash.drop(i + matched)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any way to eliminate these allocations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can overload the get method to accept an index and use that as the starting i in this method. I'll open a separate PR

@jdegoes jdegoes merged commit 5ea81ef into zio:main Jun 12, 2024
62 checks passed
@kyri-petrou kyri-petrou deleted the fix-routes-different-parameter-names branch June 13, 2024 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Route parameter names and types can result in routing ambiguities despite parameter arity
2 participants