Skip to content

config: warn on unrecognized keys in debcargo.toml

Charalampos Mitrodimas requested to merge ignore-unrecognized-keys into master

Capture and warn about unrecognized configuration keys in debcargo.toml to help users identify typos while maintaining backward compatibility. This prevents silent failures where misspelled keys like "verlay" instead of "overlay" are ignored, while still allowing configs to parse.

The implementation uses #[serde(flatten)] with HashMap<String, toml::Value> to capture unknown fields in Config, SourceOverride, and PackageOverride structs. When unknown fields are detected, warnings are printed to stderr to alert users about potential typos.

Output warning example looks like this:

  Warning: Unknown fields in /tmp/.tmpginHXN/test_debcargo.toml: ["packages.lib.unknwon_field"]
	   These fields will be ignored. Please check for typos.

Also fixes test configurations that incorrectly had build_depends at the top level instead of under [source] section where it belongs. Closes: #84

Edited by Charalampos Mitrodimas

Merge request reports

Loading