Skip to main content

rocketmq_protocol/protocol/body/
delete_topic_list_request_body.rs

1// Copyright 2026 The RocketMQ Rust Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use cheetah_string::CheetahString;
16use serde::Deserialize;
17use serde::Serialize;
18
19/// Java-compatible body for deleting multiple Broker topics in one request.
20#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
21#[serde(rename_all = "camelCase")]
22pub struct DeleteTopicListRequestBody {
23    pub topic_list: Vec<CheetahString>,
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29
30    #[test]
31    fn topic_list_body_uses_java_wire_field() {
32        let body = DeleteTopicListRequestBody {
33            topic_list: vec![
34                CheetahString::from_static_str("TopicA"),
35                CheetahString::from_static_str("TopicB"),
36            ],
37        };
38
39        let encoded = serde_json::to_string(&body).expect("encode topic list");
40        assert_eq!(r#"{"topicList":["TopicA","TopicB"]}"#, encoded);
41        assert_eq!(body, serde_json::from_str(&encoded).expect("decode topic list"));
42    }
43}