diff --git a/crates/teloxide-core/CHANGELOG.md b/crates/teloxide-core/CHANGELOG.md index 14289dd8..f7545030 100644 --- a/crates/teloxide-core/CHANGELOG.md +++ b/crates/teloxide-core/CHANGELOG.md @@ -43,9 +43,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `Voice::duration` - `RequestError::MigrateToChatId` single fields type to `ChatId` ([#859][pr859]) - `RequestError::RetryAfter` single fields type to `Seconds` ([#859][pr859]) +- `CallbackGame`, `ForumTopicClosed`, `ForumTopicReopened`, `GeneralForumTopicHidden`, `GeneralForumTopicUnhidden` and `WriteAccessAllowed` structures + are now defined as named (`struct S {}`) instead of unit (`struct S;`) in order to fix their deserialization ([#876][pr876]) [pr852]: https://github.com/teloxide/teloxide/pull/853 [pr859]: https://github.com/teloxide/teloxide/pull/859 +[pr876]: https://github.com/teloxide/teloxide/pull/876 ### Deprecated diff --git a/crates/teloxide-core/src/types/callback_game.rs b/crates/teloxide-core/src/types/callback_game.rs index 0fd9a9b0..9f76c1dd 100644 --- a/crates/teloxide-core/src/types/callback_game.rs +++ b/crates/teloxide-core/src/types/callback_game.rs @@ -9,4 +9,4 @@ use serde::{Deserialize, Serialize}; /// /// [@Botfather]: https://t.me/botfather #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct CallbackGame; +pub struct CallbackGame {} diff --git a/crates/teloxide-core/src/types/forum_topic_closed.rs b/crates/teloxide-core/src/types/forum_topic_closed.rs index f3a57eb2..5a1d379b 100644 --- a/crates/teloxide-core/src/types/forum_topic_closed.rs +++ b/crates/teloxide-core/src/types/forum_topic_closed.rs @@ -6,4 +6,4 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#forumtopicclosed). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct ForumTopicClosed; +pub struct ForumTopicClosed {} diff --git a/crates/teloxide-core/src/types/forum_topic_reopened.rs b/crates/teloxide-core/src/types/forum_topic_reopened.rs index faae4bd6..695fa15b 100644 --- a/crates/teloxide-core/src/types/forum_topic_reopened.rs +++ b/crates/teloxide-core/src/types/forum_topic_reopened.rs @@ -6,4 +6,4 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#forumtopicreopened). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct ForumTopicReopened; +pub struct ForumTopicReopened {} diff --git a/crates/teloxide-core/src/types/general_forum_topic_hidden.rs b/crates/teloxide-core/src/types/general_forum_topic_hidden.rs index c1863688..c4ca8779 100644 --- a/crates/teloxide-core/src/types/general_forum_topic_hidden.rs +++ b/crates/teloxide-core/src/types/general_forum_topic_hidden.rs @@ -6,4 +6,4 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#generalforumtopichidden). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct GeneralForumTopicHidden; +pub struct GeneralForumTopicHidden {} diff --git a/crates/teloxide-core/src/types/general_forum_topic_unhidden.rs b/crates/teloxide-core/src/types/general_forum_topic_unhidden.rs index ce85bfde..95a12a07 100644 --- a/crates/teloxide-core/src/types/general_forum_topic_unhidden.rs +++ b/crates/teloxide-core/src/types/general_forum_topic_unhidden.rs @@ -6,4 +6,4 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#generalforumtopicunhidden). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct GeneralForumTopicUnhidden; +pub struct GeneralForumTopicUnhidden {} diff --git a/crates/teloxide-core/src/types/message.rs b/crates/teloxide-core/src/types/message.rs index ced7ba07..61796508 100644 --- a/crates/teloxide-core/src/types/message.rs +++ b/crates/teloxide-core/src/types/message.rs @@ -1933,4 +1933,28 @@ mod tests { let msg: Message = serde_json::from_str(json).unwrap(); assert_matches!(msg.kind, MessageKind::Empty {}) } + + #[test] + fn issue_874() { + let json = r#"{ + "chat": { + "id": -1001840751935, + "is_forum": true, + "title": "AI", + "type": "supergroup" + }, + "date": 1682191229, + "forum_topic_closed": {}, + "from": { + "first_name": "Владислав", + "id": 112455916, + "is_bot": false, + "language_code": "en", + "username": "scv977" + }, + "message_id": 62 + }"#; + + let _: Message = serde_json::from_str(json).unwrap(); + } } diff --git a/crates/teloxide-core/src/types/write_access_allowed.rs b/crates/teloxide-core/src/types/write_access_allowed.rs index 64854413..bbba3731 100644 --- a/crates/teloxide-core/src/types/write_access_allowed.rs +++ b/crates/teloxide-core/src/types/write_access_allowed.rs @@ -6,4 +6,4 @@ use serde::{Deserialize, Serialize}; /// [The official docs](https://core.telegram.org/bots/api#writeaccessallowed). #[serde_with_macros::skip_serializing_none] #[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] -pub struct WriteAccessAllowed; +pub struct WriteAccessAllowed {}