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

Allow literal : in routes #1452

Closed
DavidSouther opened this issue Oct 7, 2022 · 2 comments
Closed

Allow literal : in routes #1452

DavidSouther opened this issue Oct 7, 2022 · 2 comments

Comments

@DavidSouther
Copy link

DavidSouther commented Oct 7, 2022

Feature Request

Allow a way to register routes (and route fragments) that include a literal :

Motivation

REST (GCP) Api (Azure) Guidelines† (OpenAPI) suggest mechanisms to define custom verbs using POST /collection/{id}:verb. In axum, this is ambiguous as /collection/12:archive for the route /collection/:id:verb matches get(Path(id): Path<String>) as "12:archive". That is, the :verb gets ignored, and the entire fragment gets assigned to the first parameter match.

† Ok it's not technically in there, but it's not forbidden, as far as I can tell

Proposal

Switch (or provide the option) to use {curly-delimited} path templates. This conveniently aligns with the OpenAPI path templating spec.

Alternatives

Recognize Additional :foo after the first :path in a route fragment as literal. That is, for a route section between two "/", only the first :portion is recognized.

@DavidSouther
Copy link
Author

DavidSouther commented Oct 7, 2022

Looks like this might be a better issue for matchit.

Edit: So it is: ibraheemdev/matchit#23

@davidpdrsn
Copy link
Member

Yep. There isn't anything axum can do about this so I'll close since we already have a matchit issue.

@davidpdrsn davidpdrsn closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants