From 55a2610eff9135da61a523ee13760567f6f48f09 Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Tue, 1 Nov 2022 14:15:28 -0500 Subject: [PATCH] More lenient parsing --- src/cohost_posts.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cohost_posts.rs b/src/cohost_posts.rs index d94b0ef..a3c03aa 100644 --- a/src/cohost_posts.rs +++ b/src/cohost_posts.rs @@ -26,12 +26,13 @@ pub struct CohostPostsPage { pub struct CohostPost { #[serde(rename = "postId")] pub id: u64, + #[serde(default)] pub headline: String, #[serde(rename = "publishedAt")] pub published_at: DateTime, pub cws: Vec, pub tags: Vec, - #[serde(rename = "plainTextBody")] + #[serde(rename = "plainTextBody", default)] pub plain_body: String, #[serde(rename = "singlePostPageUrl")] pub url: String, @@ -46,18 +47,23 @@ pub struct CohostPostingProject { #[serde(rename = "projectId")] pub id: u64, pub handle: String, - #[serde(rename = "displayName")] + #[serde(rename = "displayName", default)] pub display_name: String, + #[serde(default)] pub dek: String, + #[serde(default)] pub description: String, + #[serde(default)] pub pronouns: String, } #[derive(Deserialize)] pub struct CohostPostLink { + #[serde(default)] pub href: String, + #[serde(default)] pub rel: String, - #[serde(rename = "type")] + #[serde(rename = "type", default)] pub t_type: String, }