From 55114b37771d0e12c3b4d56be9c822af31555023 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 24 Jan 2022 11:53:56 -0600 Subject: [PATCH] fix(config): Allow check-file to work Looks like `deny_unknown_fields` doesn't work with `flatten`. See serde-rs/serde#1547. Fixes #406 --- src/config.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index bed6020..4fbcdbd 100644 --- a/src/config.rs +++ b/src/config.rs @@ -235,7 +235,7 @@ impl TypeEngineConfig { } #[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -#[serde(deny_unknown_fields)] +//#[serde(deny_unknown_fields)] // Doesn't work with `flatten` #[serde(default)] #[serde(rename_all = "kebab-case")] pub struct GlobEngineConfig { @@ -252,7 +252,7 @@ impl GlobEngineConfig { } #[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)] -#[serde(deny_unknown_fields)] +//#[serde(deny_unknown_fields)] // Doesn't work with `flatten` #[serde(default)] #[serde(rename_all = "kebab-case")] pub struct EngineConfig { @@ -575,6 +575,7 @@ mod test { fn parse_extend_globs() { let input = r#"[type.po] extend-glob = ["*.po"] +check-file = true "#; let mut expected = Config::default(); expected.type_.patterns.insert( @@ -584,6 +585,7 @@ extend-glob = ["*.po"] engine: EngineConfig { tokenizer: Some(TokenizerConfig::default()), dict: Some(DictConfig::default()), + check_file: Some(true), ..Default::default() }, ..Default::default()