"with_list_parse_key" environment parser does not support vector field
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 265
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
Not sure if I doing it wrongly or misunderstand the source code, the with_list_parse_key option is creating a map that will be used to check if a field should use list parser. In the case of vector of struct that contains vector field it is not possible to specify the key unless we specify all the possible index.
struct Nested {
pub keys: Vec<String>,
}
struct Config {
pub nested: Vec<Nested>
}
let env_source = Environment::with_prefix("server_config")
.list_separator(",")
// note: need to list all the possible index
.with_list_parse_key("nested[0].keys")
.with_list_parse_key("nested[1].keys")
.try_parsing(true);
Is this the expected behaviour or could it be possible to support key like nested[*].keys?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Environment::with_list_parse_key entry point and trace how its keys are matched by the environment list parser. Reproduce the nested vector-of-struct example, then determine the expected wildcard behavior and add coverage showing that nested[*].keys handles vector fields without enumerating indexes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100