diff --git a/src/fanbox/article/body.rs b/src/fanbox/article/body.rs index 4306ec9..1894f00 100644 --- a/src/fanbox/article/body.rs +++ b/src/fanbox/article/body.rs @@ -1,6 +1,9 @@ +use super::super::check::CheckUnkown; +use super::super::error::FanboxAPIError; use super::block::FanboxArticleBlock; use crate::fanbox_api::FanboxClientInternal; use json::JsonValue; +use proc_macros::check_json_keys; use std::fmt::Debug; use std::sync::Arc; @@ -36,6 +39,21 @@ impl FanboxArticleBody { } } +impl CheckUnkown for FanboxArticleBody { + fn check_unknown(&self) -> Result<(), FanboxAPIError> { + check_json_keys!("blocks"+, "imageMap", "fileMap", "embedMap", "urlEmbedMap",); + match self.blocks() { + Some(blocks) => { + for i in blocks { + i.check_unknown()?; + } + } + None => {} + } + Ok(()) + } +} + impl Debug for FanboxArticleBody { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("FanboxArticleBody")