From 1fc26208bb16f1c3e05597b005ec61699a2e5aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kleinb=C3=B6lting?= Date: Fri, 19 Jul 2024 14:59:46 +0200 Subject: [PATCH] add missing url type enum --- dsp-meta/tests/json-toml.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dsp-meta/tests/json-toml.rs b/dsp-meta/tests/json-toml.rs index 399e051d..68122544 100644 --- a/dsp-meta/tests/json-toml.rs +++ b/dsp-meta/tests/json-toml.rs @@ -200,6 +200,28 @@ pub struct Date(String); pub struct Url { pub url: String, pub text: Option, + #[serde(rename = "type")] + #[serde(default = "UrlType::default")] + pub url_type: UrlType, +} + +#[derive(Debug, Serialize, Deserialize, PartialEq)] +pub enum UrlType { + URL, + Geonames, + Pleiades, + Skos, + Periodo, + Chronontology, + GND, + VIAF, + Grid, + ORCID, + #[serde(rename = "Creative Commons")] + CreativeCommons, +} +impl UrlType { + fn default() -> Self { UrlType::URL } } #[derive(Debug, Serialize, Deserialize, PartialEq)] @@ -259,6 +281,7 @@ fn untagged_enum() { UrlValue(Url { url: "url".to_string(), text: Some("text".to_string()), + url_type: UrlType::URL, })); val.push(TextValue(Text([("en".to_string(), "English".to_string())].iter().cloned().collect()))); let un = P {