notionrs_schema/object/database/
url.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Deserialize, Serialize, Debug, Default, Clone, PartialEq, Eq, notionrs_macro::Setter)]
4pub struct DatabaseUrlProperty {
5 #[serde(skip_serializing)]
7 pub id: Option<String>,
8
9 #[serde(skip_serializing)]
11 pub name: String,
12
13 #[serde(skip_serializing)]
16 pub description: Option<String>,
17
18 pub url: std::collections::HashMap<(), ()>,
20}
21
22#[cfg(test)]
28mod unit_tests {
29
30 use super::*;
31
32 #[test]
33 fn deserialize_database_url_property() {
34 let json_data = r#"
35 {
36 "id": "BZKU",
37 "name": "Project URL",
38 "type": "url",
39 "url": {}
40 }
41 "#;
42
43 let url = serde_json::from_str::<DatabaseUrlProperty>(json_data).unwrap();
44
45 assert_eq!(url.id, Some("BZKU".to_string()));
46 assert_eq!(url.name, "Project URL");
47 assert_eq!(url.url, std::collections::HashMap::new());
48 }
49}