feat: impl deserialize manually to fix case sensitivity
This commit is contained in:
parent
46006ae5ef
commit
1a17f8ea99
@ -2,7 +2,7 @@ use std::{fmt::Display, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone, Debug)]
|
||||
#[derive(Serialize, Clone, Debug)]
|
||||
pub enum DataType {
|
||||
DateTime,
|
||||
String,
|
||||
@ -49,3 +49,14 @@ impl FromStr for DataType {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for DataType {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
D: serde::Deserializer<'de>,
|
||||
{
|
||||
let s = String::deserialize(deserializer)?;
|
||||
DataType::from_str(&s)
|
||||
.map_err(|_| serde::de::Error::custom(format!("invalid Datatype: {}", s)))
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user