@@ -29,7 +29,7 @@ use crate::core::{
2929 ButtplugServerMessageVariant ,
3030 } ,
3131} ;
32- use jsonschema:: JSONSchema ;
32+ use jsonschema:: Validator ;
3333use once_cell:: sync:: OnceCell ;
3434use serde:: { Deserialize , Serialize } ;
3535use serde_json:: { Deserializer , Value } ;
@@ -39,14 +39,14 @@ static MESSAGE_JSON_SCHEMA: &str =
3939 include_str ! ( "../../../../buttplug-schema/schema/buttplug-schema.json" ) ;
4040
4141/// Creates a [jsonschema::JSONSchema] validator using the built in buttplug message schema.
42- pub fn create_message_validator ( ) -> JSONSchema {
42+ pub fn create_message_validator ( ) -> Validator {
4343 let schema: serde_json:: Value =
4444 serde_json:: from_str ( MESSAGE_JSON_SCHEMA ) . expect ( "Built in schema better be valid" ) ;
45- JSONSchema :: compile ( & schema) . expect ( "Built in schema better be valid" )
45+ Validator :: new ( & schema) . expect ( "Built in schema better be valid" )
4646}
4747pub struct ButtplugServerJSONSerializer {
4848 pub ( super ) message_version : OnceCell < message:: ButtplugMessageSpecVersion > ,
49- validator : JSONSchema ,
49+ validator : Validator ,
5050}
5151
5252impl Default for ButtplugServerJSONSerializer {
8383}
8484
8585pub fn deserialize_to_message < T > (
86- validator : & JSONSchema ,
86+ validator : & Validator ,
8787 msg_str : & str ,
8888) -> Result < Vec < T > , ButtplugSerializerError >
8989where
@@ -319,7 +319,7 @@ impl ButtplugMessageSerializer for ButtplugServerJSONSerializer {
319319}
320320
321321pub struct ButtplugClientJSONSerializerImpl {
322- validator : JSONSchema ,
322+ validator : Validator ,
323323}
324324
325325impl Default for ButtplugClientJSONSerializerImpl {
0 commit comments