config-rs icon indicating copy to clipboard operation
config-rs copied to clipboard

Can't parse an empty array with the env parser

Open gurinderu opened this issue 2 years ago • 0 comments

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

gurinderu avatar Jul 19 '23 15:07 gurinderu