Browse Source

Make models fail when encountering unknown attributes

master
Drew Short 5 years ago
parent
commit
6cf71e426b
  1. 8
      src/model.rs

8
src/model.rs

@ -2,6 +2,7 @@ use chrono::DateTime;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
pub struct AnimeBoxesBackup { pub struct AnimeBoxesBackup {
#[serde(rename(serialize = "backupTime", deserialize = "backupTime"))] #[serde(rename(serialize = "backupTime", deserialize = "backupTime"))]
backup_time: DateTime<chrono::Utc>, backup_time: DateTime<chrono::Utc>,
@ -20,6 +21,7 @@ pub struct AnimeBoxesBackup {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesFavorite { struct AnimeBoxesFavorite {
#[serde(rename(serialize = "dateAdded", deserialize = "dateAdded"))] #[serde(rename(serialize = "dateAdded", deserialize = "dateAdded"))]
date_added: DateTime<chrono::Utc>, date_added: DateTime<chrono::Utc>,
@ -60,6 +62,7 @@ struct AnimeBoxesFavorite {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesFavoriteFile { struct AnimeBoxesFavoriteFile {
#[serde(rename(serialize = "contentType", deserialize = "contentType"))] #[serde(rename(serialize = "contentType", deserialize = "contentType"))]
content_type: i8, content_type: i8,
@ -70,6 +73,7 @@ struct AnimeBoxesFavoriteFile {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesFavoriteJpeg { struct AnimeBoxesFavoriteJpeg {
#[serde(rename(serialize = "contentType", deserialize = "contentType"))] #[serde(rename(serialize = "contentType", deserialize = "contentType"))]
content_type: i8, content_type: i8,
@ -80,6 +84,7 @@ struct AnimeBoxesFavoriteJpeg {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesFavoritePreview { struct AnimeBoxesFavoritePreview {
#[serde(rename(serialize = "contentType", deserialize = "contentType"))] #[serde(rename(serialize = "contentType", deserialize = "contentType"))]
content_type: i8, content_type: i8,
@ -90,6 +95,7 @@ struct AnimeBoxesFavoritePreview {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesFavoriteSample { struct AnimeBoxesFavoriteSample {
#[serde(rename(serialize = "contentType", deserialize = "contentType"))] #[serde(rename(serialize = "contentType", deserialize = "contentType"))]
content_type: i8, content_type: i8,
@ -100,6 +106,7 @@ struct AnimeBoxesFavoriteSample {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesSearch { struct AnimeBoxesSearch {
#[serde(rename(serialize = "itemId", deserialize = "itemId"))] #[serde(rename(serialize = "itemId", deserialize = "itemId"))]
item_id: i32, item_id: i32,
@ -111,6 +118,7 @@ struct AnimeBoxesSearch {
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
#[serde(deny_unknown_fields)]
struct AnimeBoxesServer { struct AnimeBoxesServer {
#[serde(rename(serialize = "apikey", deserialize = "apikey"))] #[serde(rename(serialize = "apikey", deserialize = "apikey"))]
api_key: String, api_key: String,

Loading…
Cancel
Save