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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work correctly with serde's deny_unknown_fields #60

Open
ibotty opened this issue May 19, 2021 · 0 comments
Open

Does not work correctly with serde's deny_unknown_fields #60

ibotty opened this issue May 19, 2021 · 0 comments

Comments

@ibotty
Copy link

ibotty commented May 19, 2021

馃悰 Bug description

With a struct that uses serde's deny_unknown_fields container attribute using non-prefixed keys envy kind-of correctly fails with the error unknown field an_other_env_variable, expected one of ....

Arguably that pragma does not make sense for that case, but might be necessary for other (de)serializations.

馃 Expected Behavior

It ignores the other environment variables.

馃憻 Steps to reproduce

use serde::Deserialize;

#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Config {
    size: Option<u32>,
}

fn main() {
    match envy::from_env::<Config>() {
        Ok(config) => println!("provided config.size {:?}", config.size),
        Err(err) => println!("error parsing config from env: {}", err),
    }
}

envy version: 0.4.1

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

1 participant