diff --git a/crates/json-ld/Cargo.toml b/crates/json-ld/Cargo.toml index 05ab91db3..d227179d5 100644 --- a/crates/json-ld/Cargo.toml +++ b/crates/json-ld/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssi-json-ld" -version = "0.3.0" +version = "0.3.1" edition = "2021" authors = ["Spruce Systems, Inc."] license = "Apache-2.0" @@ -31,4 +31,4 @@ serde.workspace = true difference = "2.0" nquads-syntax.workspace = true serde_json.workspace = true -tokio = { version = "1.27.0", features = ["rt", "macros"] } \ No newline at end of file +tokio = { version = "1.27.0", features = ["rt", "macros"] } diff --git a/crates/json-ld/src/lib.rs b/crates/json-ld/src/lib.rs index 9554881e2..e8f36d215 100644 --- a/crates/json-ld/src/lib.rs +++ b/crates/json-ld/src/lib.rs @@ -225,6 +225,21 @@ impl<'a> serde::Serialize for JsonLdTypes<'a> { } } +impl<'a> From> for Vec { + fn from(value: JsonLdTypes<'a>) -> Self { + let mut vec: Vec = Vec::with_capacity(value.len()); + vec.extend_from_slice( + &value + .static_ + .into_iter() + .map(ToString::to_string) + .collect::>(), + ); + vec.extend(value.non_static.into_owned()); + vec + } +} + pub struct WithContext { pub context: Option, pub value: T,