From 34ad830bda68e6375b7cca4f4d4b949975060e7f Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sun, 3 Mar 2024 18:34:46 +0100 Subject: [PATCH] Deny unknown fields when parsing archive index --- src/archive/story.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/archive/story.rs b/src/archive/story.rs index c7811ee..c40d1cc 100644 --- a/src/archive/story.rs +++ b/src/archive/story.rs @@ -14,6 +14,7 @@ lazy_static! { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Story { pub archive: Archive, pub author: Author, @@ -50,6 +51,7 @@ pub struct Story { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Archive { pub date_checked: Option>, pub date_created: Option>, @@ -59,6 +61,7 @@ pub struct Archive { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Author { pub avatar: Option, pub bio_html: Option, @@ -73,6 +76,7 @@ pub struct Author { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Avatar { #[serde(rename = "16")] pub x16: Option, @@ -101,6 +105,7 @@ pub struct Avatar { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct Chapter { pub chapter_number: i32, pub date_modified: Option>, @@ -137,6 +142,7 @@ pub enum ContentRating { } #[derive(Clone, Debug, Deserialize)] +#[serde(deny_unknown_fields)] pub struct CoverImage { pub full: String, pub large: String, @@ -153,6 +159,7 @@ pub enum Status { } #[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq)] +#[serde(deny_unknown_fields)] pub struct Tag { pub id: i64, pub name: String,