Fix datatype validation to be case-sensitive

This commit is contained in:
mb 2024-06-24 15:57:51 +02:00
parent 8c7e9fab85
commit 1d99e9a298
No known key found for this signature in database

View file

@ -305,11 +305,11 @@ impl FromStr for Datatype {
return Err(Error::Other("Encountered invalid validation datatype.").into());
};
let parsed_datatype = match datatype.to_ascii_lowercase().as_str() {
"anyuri" => Datatype::AnyUri,
let parsed_datatype = match datatype {
"anyURI" => Datatype::AnyUri,
"byte" => Datatype::Byte,
"date" => Datatype::Date,
"datetime" => Datatype::DateTime,
"dateTime" => Datatype::DateTime,
"decimal" => Datatype::Decimal,
"double" => Datatype::Double,
"int" => Datatype::Int,
@ -362,7 +362,7 @@ mod tests {
#[test]
fn test_parse_datatype() -> Result<(), Error> {
assert_eq!(Datatype::AnyUri, "xs:anyURI".parse()?);
assert_eq!(Datatype::AnyUri, "xs:anyuri".parse()?);
assert!("xs:anyuri".parse::<Datatype>().is_err());
assert!("xs:".parse::<Datatype>().is_err());
assert_eq!(
Datatype::AnyUri.into_attribute_value(),