From 292e6402cb425ad5439a3b267c52369cc951c56a Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Thu, 29 Feb 2024 10:01:19 -0400 Subject: [PATCH] Stricter serde constraints --- src/aptfile.rs | 1 + src/debian.rs | 1 + src/layers/installed_packages.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/aptfile.rs b/src/aptfile.rs index 74863ca..c14df2a 100644 --- a/src/aptfile.rs +++ b/src/aptfile.rs @@ -4,6 +4,7 @@ use std::collections::HashSet; use std::str::FromStr; #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub(crate) struct Aptfile { packages: HashSet, } diff --git a/src/debian.rs b/src/debian.rs index 24a96f2..8a41684 100644 --- a/src/debian.rs +++ b/src/debian.rs @@ -3,6 +3,7 @@ use std::fmt::{Display, Formatter}; use std::str::FromStr; #[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] // https://www.debian.org/doc/debian-policy/ch-controlfields.html#source pub(crate) struct DebianPackageName(pub(crate) String); diff --git a/src/layers/installed_packages.rs b/src/layers/installed_packages.rs index e3ad73a..d818607 100644 --- a/src/layers/installed_packages.rs +++ b/src/layers/installed_packages.rs @@ -66,6 +66,7 @@ impl<'a> Layer for InstalledPackagesLayer<'a> { } #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] +#[serde(deny_unknown_fields)] pub(crate) struct InstalledPackagesMetadata { arch: String, aptfile: Aptfile,