Skip to content

Commit a1e98bc

Browse files
committed
Add missing deserialization support for Uuid.
1 parent 5f17c5b commit a1e98bc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/base/value.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use serde::{
99
Deserialize, Serialize,
1010
};
1111
use std::{collections::BTreeMap, ops::Deref, sync::Arc};
12-
use uuid::Uuid;
1312

1413
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
1514
pub struct RangeValue {
@@ -77,7 +76,7 @@ pub enum KeyValue {
7776
Bool(bool),
7877
Int64(i64),
7978
Range(RangeValue),
80-
Uuid(Uuid),
79+
Uuid(uuid::Uuid),
8180
Struct(Vec<KeyValue>),
8281
}
8382

@@ -304,7 +303,7 @@ pub enum BasicValue {
304303
Float32(f32),
305304
Float64(f64),
306305
Range(RangeValue),
307-
Uuid(Uuid),
306+
Uuid(uuid::Uuid),
308307
Json(Arc<serde_json::Value>),
309308
Vector(Arc<[BasicValue]>),
310309
}
@@ -775,6 +774,9 @@ impl BasicValue {
775774
.ok_or_else(|| anyhow::anyhow!("invalid fp64 value {v}"))?,
776775
),
777776
(v, BasicValueType::Range) => BasicValue::Range(serde_json::from_value(v)?),
777+
(serde_json::Value::String(v), BasicValueType::Uuid) => {
778+
BasicValue::Uuid(uuid::Uuid::parse_str(v.as_str())?)
779+
}
778780
(v, BasicValueType::Json) => BasicValue::Json(Arc::from(v)),
779781
(
780782
serde_json::Value::Array(v),

0 commit comments

Comments
 (0)