added attributes to AdjacentMetadata (#624)

* added attributes to AdjacentMetadata

* ran fmt
This commit is contained in:
Boegie19
2022-08-21 04:32:58 +02:00
committed by GitHub
parent 72d62220e8
commit 9876508887

View File

@@ -19,6 +19,9 @@ pub struct AdjacentMetadata {
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub properties: HashMap<String, UnresolvedValue>,
#[serde(default, skip_serializing_if = "HashMap::is_empty")]
pub attributes: HashMap<String, UnresolvedValue>,
#[serde(skip)]
pub path: PathBuf,
}
@@ -53,6 +56,19 @@ impl AdjacentMetadata {
snapshot.properties.insert(key, value);
}
if !self.attributes.is_empty() {
let mut attributes = Attributes::new();
for (key, unresolved) in self.attributes.drain() {
let value = unresolved.resolve_unambiguous()?;
attributes.insert(key, value);
}
snapshot
.properties
.insert("Attributes".into(), attributes.into());
}
Ok(())
}