diff --git a/src/api/apps.rs b/src/api/apps.rs index 2b1e0675..c24dd93b 100644 --- a/src/api/apps.rs +++ b/src/api/apps.rs @@ -4,7 +4,7 @@ use rsb_derive::Builder; use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; +use serde_with::{serde_as, skip_serializing_none}; use url::Url; use crate::*; @@ -124,13 +124,14 @@ pub struct SlackApiAppsConnectionOpenResponse { pub url: SlackWebSocketsUrl, } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackApiAppsManifestCreateRequest { pub app_id: SlackAppId, // This API requires a "json-encoded" string in a JSON object. - #[serde(with = "serde_with::json::nested")] + #[serde_as(as = "serde_with::json::JsonString")] pub manifest: SlackAppManifest, } @@ -160,13 +161,14 @@ pub struct SlackApiAppsManifestExportResponse { pub manifest: SlackAppManifest, } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackApiAppsManifestUpdateRequest { pub app_id: SlackAppId, // This API requires a "json-encoded" string in a JSON object. - #[serde(with = "serde_with::json::nested")] + #[serde_as(as = "serde_with::json::JsonString")] pub manifest: SlackAppManifest, } @@ -177,11 +179,12 @@ pub struct SlackApiAppsManifestUpdateResponse { pub permissions_updated: bool, } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackApiAppsManifestValidateRequest { // This API requires a "json-encoded" string in a JSON object. - #[serde(with = "serde_with::json::nested")] + #[serde_as(as = "serde_with::json::JsonString")] pub manifest: SlackAppManifest, pub app_id: Option, diff --git a/src/models/blocks/view.rs b/src/models/blocks/view.rs index 52a9eb55..3da1af5e 100644 --- a/src/models/blocks/view.rs +++ b/src/models/blocks/view.rs @@ -4,7 +4,7 @@ use crate::SlackCallbackId; use crate::*; use rsb_derive::Builder; use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; +use serde_with::{serde_as, skip_serializing_none}; use std::collections::HashMap; #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] @@ -16,21 +16,23 @@ pub enum SlackView { Modal(SlackModalView), } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackHomeView { pub blocks: Vec, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub private_metadata: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub callback_id: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub external_id: Option, } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackModalView { @@ -39,16 +41,16 @@ pub struct SlackModalView { pub close: Option, pub submit: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub private_metadata: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub callback_id: Option, pub clear_on_close: Option, pub notify_on_close: Option, pub hash: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub external_id: Option, } diff --git a/src/models/common/mod.rs b/src/models/common/mod.rs index abbf7e37..d7153278 100644 --- a/src/models/common/mod.rs +++ b/src/models/common/mod.rs @@ -3,7 +3,7 @@ use chrono::{DateTime, TimeZone, Utc}; use rsb_derive::Builder; use rvstruct::ValueStruct; use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; +use serde_with::{serde_as, skip_serializing_none}; use std::hash::Hash; use std::*; use url::Url; @@ -166,11 +166,12 @@ impl fmt::Debug for SlackSigningSecret { #[derive(Debug, Eq, PartialEq, Hash, Clone, Serialize, Deserialize, ValueStruct)] pub struct EmailAddress(pub String); +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackResponseMetadata { #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub next_cursor: Option, } diff --git a/src/models/events/interaction.rs b/src/models/events/interaction.rs index 2ee30dd1..f5795651 100644 --- a/src/models/events/interaction.rs +++ b/src/models/events/interaction.rs @@ -1,6 +1,6 @@ use rsb_derive::Builder; use serde::{Deserialize, Serialize}; -use serde_with::skip_serializing_none; +use serde_with::{serde_as, skip_serializing_none}; use crate::blocks::*; use crate::models::messages::*; @@ -77,6 +77,7 @@ pub struct SlackInteractionActionInfo { pub action_ts: Option, } +#[serde_as] #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Builder)] pub struct SlackInteractionDialogueSubmissionEvent { @@ -84,7 +85,7 @@ pub struct SlackInteractionDialogueSubmissionEvent { pub user: SlackBasicUserInfo, pub channel: Option, #[serde(default)] - #[serde(with = "serde_with::rust::string_empty_as_none")] + #[serde_as(as = "serde_with::NoneAsEmptyString")] pub callback_id: Option, pub state: Option, pub submission: HashMap,