Skip to content

axum: Update matchit to 0.8.6 and support capture prefixes and suffixes#3679

Open
ADD-SP wants to merge 3 commits intomainfrom
add_sp/bump-matchit
Open

axum: Update matchit to 0.8.6 and support capture prefixes and suffixes#3679
ADD-SP wants to merge 3 commits intomainfrom
add_sp/bump-matchit

Conversation

@ADD-SP
Copy link
Copy Markdown
Member

@ADD-SP ADD-SP commented Mar 5, 2026

Copy-pasting from #3143 to move forward this work.

@@ -0,0 +1,4 @@
[default]
extend-ignore-re = [
"`([^`]+)`",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is to suppress the false positive of type checker

Copy link
Copy Markdown
Contributor

@jplatte jplatte Mar 5, 2026

Choose a reason for hiding this comment

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

I think this is much too broad of an exclusion. Just update the docs sample to something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Content wrapped in backticks usually consists of proper nouns and inline code, so I think it’s reasonable to exclude this pattern.

Comment on lines +48 to +61
You may mix captures that have different static prefixes or suffixes, though it is discouraged as it
might lead to surprising behavior. If multiple routes would match, the one with the longest static
prefix is used, if there are multiple with the same match, the longest matched static suffix is
chosen. For example, if a request is done to `/abcdef` here are examples of routes that would all
match. If multiple of these were defined in a single router, the topmost one would be used.

- `/abcdef`
- `/abc{x}ef`
- `/abc{x}f`
- `/abc{x}`
- `/a{x}def`
- `/a{x}`
- `/{x}def`
- `/{x}`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the reason we didn't merge the 0.8.6 update. The logic is simply too surprising.

If you want to push this forward, can you please update matchit to 0.9 and change the documentation (and possibly the new tests) to align with that version? That version disallows these semi-conflicting routes in a single router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants