-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
- I have looked for existing issues (including closed) about this
Feature Request
The path extractor currently only supports greedy extraction of the entire wildcard path value into a String value. It should also support Vec<T> and handle the value extraction and parsing to T.
Though I personally only need support for Vec<String> :)
Motivation
Currently wildcard values are generally deserialized into a String and the user has to handle value extraction.
For a project I would like to implement nested groups/namespaces, which requires using wildcards. This would require me to handle extracting the path values into a Vec<String> before I can run logic for the strings.
I don't see why axum's Path extractor shouldn't support Vec<String>, so here I am.
Proposal
In axum\src\extract\path\de.rs have ValueDeserializer support serde deserialization with deserialize_seq.
The PathDeserializer would supply the wildcard path as string, which could then be split by / and pushed to the sequence.
Alternatives
Manually implement wildcard String value splitting by / chars for each wildcard route or write a custom path extractor and maybe submit that for axum-extra.