Skip to content

Commit

Permalink
Add xml namespace serialization / deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
snpefk committed Sep 29, 2024
1 parent 2656a92 commit 9943cfb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/opensi-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub struct Package {
pub logo: Option<String>,
#[serde(rename = "@restriction", skip_serializing_if = "Option::is_none")]
pub restriction: Option<String>,
#[serde(rename = "@xmlns")]
pub namespace: String,

// elements
pub info: Info,
Expand Down Expand Up @@ -367,7 +369,12 @@ pub struct Question {
pub scenario: Vec<Atom>,
#[serde(deserialize_with = "unwrap_list", serialize_with = "wrap_answer_list")]
pub right: Vec<Answer>,
#[serde(deserialize_with = "unwrap_option_list", default, serialize_with = "wrap_option_answer_list", skip_serializing_if = "Option::is_none",)]
#[serde(
deserialize_with = "unwrap_option_list",
default,
serialize_with = "wrap_option_answer_list",
skip_serializing_if = "Option::is_none"
)]
pub wrong: Option<Vec<Answer>>,
#[serde(rename = "@info", skip_serializing_if = "Option::is_none")]
pub info: Option<Info>,
Expand Down

0 comments on commit 9943cfb

Please sign in to comment.