Skip to content

Commit d3f759f

Browse files
authored
Fix schema deserialization in case of missing metadata (#345)
1 parent 7816e1e commit d3f759f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/src/storage/object_storage.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,17 @@ pub trait ObjectStorage: Sync + 'static {
194194
"metadata".to_string(),
195195
Value::Object(serde_json::Map::new()),
196196
);
197+
198+
for field in schema["fields"]
199+
.as_array_mut()
200+
.expect("fields is json array")
201+
{
202+
let map = field.as_object_mut().unwrap();
203+
map.insert(
204+
"metadata".to_string(),
205+
Value::Object(serde_json::Map::new()),
206+
);
207+
}
197208
}
198209

199210
Ok(serde_json::from_value(schema_map)

0 commit comments

Comments
 (0)