Skip to content

Commit 0a04aa0

Browse files
authored
Return category if present in downloaded offchain metadata (#264)
* Fix docker build * Fix clippy error * Add category to RPC response for content, if present
1 parent 23f4006 commit 0a04aa0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

digital_asset_types/src/dapi/common/asset.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ pub fn v1_content_from_json(asset_data: &asset_data::Model) -> Result<Content, D
211211
links.insert(f.to_string(), l.to_owned());
212212
}
213213
}
214-
let _metadata = safe_select(selector, "description");
214+
let category = safe_select(selector, "$.properties.category").cloned();
215+
215216
let mut actual_files: HashMap<String, File> = HashMap::new();
216217
if let Some(files) = selector("$.properties.files[*]")
217218
.ok()
@@ -280,6 +281,7 @@ pub fn v1_content_from_json(asset_data: &asset_data::Model) -> Result<Content, D
280281
files: Some(files),
281282
metadata: meta,
282283
links: Some(links),
284+
category,
283285
})
284286
}
285287

digital_asset_types/src/rpc/asset.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ pub struct Content {
180180
pub metadata: MetadataMap,
181181
#[serde(skip_serializing_if = "Option::is_none")]
182182
pub links: Option<Links>,
183+
#[serde(skip_serializing_if = "Option::is_none")]
184+
pub category: Option<Value>,
183185
}
184186

185187
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]

0 commit comments

Comments
 (0)