Skip to content

Commit 5451d76

Browse files
committed
Fix parsing tags
1 parent c870998 commit 5451d76

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

crates/opensi-core/src/serde_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ generate_serde_mod!(atoms: crate::v5::AtomV5 as atom);
4040
generate_serde_mod!(answers: crate::v5::AnswerV5 as answer);
4141
generate_serde_mod!(authors: String as author);
4242
generate_serde_mod!(sources: String as source);
43+
generate_serde_mod!(tags: crate::v5::Tag as tag);

crates/opensi-core/src/v5/components.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,9 @@ pub struct AtomV5 {
174174
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
175175
pub body: Option<String>,
176176
}
177+
178+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
179+
pub struct Tag {
180+
#[serde(rename = "$value", skip_serializing_if = "Option::is_none")]
181+
pub body: Option<String>,
182+
}

crates/opensi-core/src/v5/package.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::{fs::File, io, io::Read};
1010
use zip::write::FileOptions;
1111
use zip::{CompressionMethod, ZipArchive, ZipWriter};
1212

13-
use super::components::{AtomV5, InfoV5, RoundV5};
13+
use super::components::{AtomV5, InfoV5, RoundV5, Tag};
1414
use crate::package_trait::RoundContainer;
1515
use crate::serde_impl;
1616

@@ -46,8 +46,8 @@ pub struct PackageV5 {
4646
pub info: InfoV5,
4747
#[serde(default, with = "serde_impl::rounds")]
4848
pub rounds: Vec<RoundV5>,
49-
#[serde(default, skip_serializing_if = "Vec::is_empty")]
50-
pub tags: Vec<String>,
49+
#[serde(default, with = "serde_impl::tags", skip_serializing_if = "Vec::is_empty")]
50+
pub tags: Vec<Tag>,
5151

5252
// resources
5353
#[serde(skip)]

crates/opensi-editor/src/element/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt::Display;
22

33
use opensi_core::prelude::*;
4-
4+
use opensi_core::v5::Tag;
55
use super::{property::Properties, PropertyTable};
66

77
/// A generic error label.
@@ -44,7 +44,7 @@ pub fn unselectable_label(text: impl Into<egui::WidgetText>, ui: &mut egui::Ui)
4444

4545
pub fn string_list(
4646
id: impl Into<egui::Id>,
47-
list: &mut Vec<String>,
47+
list: &mut Vec<Tag>,
4848
ui: &mut egui::Ui,
4949
) -> egui::Response {
5050
ui.push_id(id.into(), |ui| {

0 commit comments

Comments
 (0)