From cc728afb7dd62d05463d9ee8b630a1e76a579606 Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 10 Dec 2022 17:30:19 +0000 Subject: [PATCH] Remove unused fields from Object and Activity types --- src/activitypub/activity.rs | 51 +++---------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/src/activitypub/activity.rs b/src/activitypub/activity.rs index e6f2869..967b9a3 100644 --- a/src/activitypub/activity.rs +++ b/src/activitypub/activity.rs @@ -38,72 +38,33 @@ pub struct Tag { pub media_type: Option, } -#[derive(Default, Deserialize, Serialize)] +#[derive(Deserialize)] +#[cfg_attr(test, derive(Default))] #[serde(rename_all = "camelCase")] pub struct Object { - #[serde(rename = "@context")] - pub context: Option, - pub id: String, #[serde(rename = "type")] pub object_type: String, - #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub actor: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub attachment: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub cc: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub former_type: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub media_type: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub object: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub published: Option>, - - #[serde(skip_serializing_if = "Option::is_none")] pub attributed_to: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub in_reply_to: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub content: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub quote_url: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub tag: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub to: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub updated: Option>, - - #[serde(skip_serializing_if = "Option::is_none")] pub url: Option, } -#[derive(Deserialize, Serialize)] +#[derive(Deserialize)] #[serde(rename_all = "camelCase")] pub struct Activity { - #[serde(rename = "@context")] - pub context: Value, - pub id: String, #[serde(rename = "type")] @@ -111,13 +72,7 @@ pub struct Activity { pub actor: String, pub object: Value, - - #[serde(skip_serializing_if = "Option::is_none")] pub target: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub to: Option, - - #[serde(skip_serializing_if = "Option::is_none")] pub cc: Option, }