diff --git a/crates/opensi-core/src/serde_impl.rs b/crates/opensi-core/src/serde_impl.rs index e216945..3347f53 100644 --- a/crates/opensi-core/src/serde_impl.rs +++ b/crates/opensi-core/src/serde_impl.rs @@ -40,3 +40,4 @@ generate_serde_mod!(atoms: crate::v5::AtomV5 as atom); generate_serde_mod!(answers: crate::v5::AnswerV5 as answer); generate_serde_mod!(authors: String as author); generate_serde_mod!(sources: String as source); +generate_serde_mod!(tags: crate::v5::Tag as tag); diff --git a/crates/opensi-core/src/v5/components.rs b/crates/opensi-core/src/v5/components.rs index f394e6f..a1acaad 100644 --- a/crates/opensi-core/src/v5/components.rs +++ b/crates/opensi-core/src/v5/components.rs @@ -174,3 +174,9 @@ pub struct AtomV5 { #[serde(rename = "$value", skip_serializing_if = "Option::is_none")] pub body: Option, } + +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] +pub struct Tag { + #[serde(rename = "$value", skip_serializing_if = "Option::is_none")] + pub body: Option, +} diff --git a/crates/opensi-core/src/v5/package.rs b/crates/opensi-core/src/v5/package.rs index 240d73d..fb4019f 100644 --- a/crates/opensi-core/src/v5/package.rs +++ b/crates/opensi-core/src/v5/package.rs @@ -10,7 +10,7 @@ use std::{fs::File, io, io::Read}; use zip::write::FileOptions; use zip::{CompressionMethod, ZipArchive, ZipWriter}; -use super::components::{AtomV5, InfoV5, RoundV5}; +use super::components::{AtomV5, InfoV5, RoundV5, Tag}; use crate::package_trait::RoundContainer; use crate::serde_impl; @@ -46,8 +46,8 @@ pub struct PackageV5 { pub info: InfoV5, #[serde(default, with = "serde_impl::rounds")] pub rounds: Vec, - #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub tags: Vec, + #[serde(default, with = "serde_impl::tags", skip_serializing_if = "Vec::is_empty")] + pub tags: Vec, // resources #[serde(skip)] diff --git a/crates/opensi-editor/src/element/common.rs b/crates/opensi-editor/src/element/common.rs index 2bcedbe..2a72a58 100644 --- a/crates/opensi-editor/src/element/common.rs +++ b/crates/opensi-editor/src/element/common.rs @@ -1,7 +1,7 @@ use std::fmt::Display; use opensi_core::prelude::*; - +use opensi_core::v5::Tag; use super::{property::Properties, PropertyTable}; /// A generic error label. @@ -44,7 +44,7 @@ pub fn unselectable_label(text: impl Into, ui: &mut egui::Ui) pub fn string_list( id: impl Into, - list: &mut Vec, + list: &mut Vec, ui: &mut egui::Ui, ) -> egui::Response { ui.push_id(id.into(), |ui| {