Can't parse an empty array with the env parser
Open
Nobody has claimed this yet.
A-env
- Dominant language
- Rust
- Stars
- 3.2k
- Forks
- 265
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
I am trying to parse a vec key with Env (with env TEST_KEY__LIST = "") source like
Environment::with_prefix("TEST")
.try_parsing(true)
.prefix_separator("_")
.separator("__")
.list_separator(",")
.with_list_parse_key("test_key.enable")
struct Config {
test_key: TestKey
}
enum Test {
One,
Two
}
struct TestKey {
enable: Vec<Test>
}
and I see
invalid type: string "", expected a sequence
I assume that the empty string should be parsed as an empty array
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
Use the Environment::with_prefix("TEST") configuration and the empty TEST_KEY__LIST value as the reproduction entry point. Trace the environment list parsing path and add or update a regression test for an empty list. Done means the empty string is accepted as an empty Vec while non-empty values retain their current parsing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100