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

Support escaping : and * #23

Closed
hgzimmerman opened this issue Aug 28, 2022 · 3 comments
Closed

Support escaping : and * #23

hgzimmerman opened this issue Aug 28, 2022 · 3 comments
Labels
feature New feature or request

Comments

@hgzimmerman
Copy link

I'm using this library by proxy of Axum, and ran into an issue in that the router would not accept path segments that contained multiple : characters, greeting me with the error: Invalid route "/Schemas/urn:ietf:params:scim:schemas:core:2.0:User": only one parameter is allowed per path segment, corresponding to the TooManyParams error variant defined in this crate.

Could either the syntax be altered to support escaping the : and * characters with a prefix like \, or have the insert method treat the whole path section as a literal if it doesn't start with a : or *, or add an .insert_components() function that takes a slice of enum Component<'a>{Literal(&'a str), Param, Wildcard, Separator} and uses that to determine the matching criteria?

@ibraheemdev
Copy link
Owner

ibraheemdev commented Sep 1, 2022

I think escaping with \ makes sense. /prefix:parameter is accepted by matchit, which makes the second option more difficult.

@DavidSouther
Copy link

Just opened this (and linked) from Axum. I would also like to propose using /{id} for path pattern matching, to align with the OpenAPI spec.

@ibraheemdev ibraheemdev added the feature New feature or request label May 23, 2023
kriswuollett added a commit to kriswuollett/matchit that referenced this issue Jul 28, 2023
Excluded `*` since it is known to not be supported yet, see ibraheemdev#23.
@ibraheemdev ibraheemdev mentioned this issue Jul 28, 2023
3 tasks
ibraheemdev pushed a commit that referenced this issue Jul 28, 2023
excluded `*` since it is known to not be supported yet, see #23.
@ibraheemdev
Copy link
Owner

With the release of 0.8, the route parameter syntax has changed to use {x} or {*x}. You can escape literal { and } characters with {{ and }} in static routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants