Skip to content

Commit

Permalink
add missing url type enum
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Jul 19, 2024
1 parent 26f5eb8 commit 1fc2620
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dsp-meta/tests/json-toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,28 @@ pub struct Date(String);
pub struct Url {
pub url: String,
pub text: Option<String>,
#[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)]
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1fc2620

Please sign in to comment.