File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 22
33use std:: { ops:: Deref , sync:: Arc } ;
44
5- use jsonschema:: { options, Draft , Validator } ;
5+ use jsonschema:: { options, Draft , ValidationError , Validator } ;
66use serde_json:: Value ;
77
88/// Wrapper around a JSON Schema validator.
@@ -17,8 +17,8 @@ pub struct JsonSchema(Arc<Validator>);
1717#[ derive( Debug , thiserror:: Error ) ]
1818pub enum SchemaBuildError {
1919 /// Invalid JSON Schema error.
20- #[ error( "Invalid JSON Schema " ) ]
21- InvalidSchema ,
20+ #[ error( "{0} " ) ]
21+ InvalidSchema ( # [ from ] ValidationError < ' static > ) ,
2222 /// Undetectable JSON schema version.
2323 #[ error(
2424 "Could not detect draft version and schema is not valid against Draft2020-12 or Draft7"
@@ -51,10 +51,7 @@ impl TryFrom<&Value> for JsonSchema {
5151 } ;
5252
5353 if let Some ( draft) = draft_version {
54- let validator = options ( )
55- . with_draft ( draft)
56- . build ( schema)
57- . map_err ( |_| SchemaBuildError :: InvalidSchema ) ?;
54+ let validator = options ( ) . with_draft ( draft) . build ( schema) ?;
5855
5956 Ok ( JsonSchema ( validator. into ( ) ) )
6057 } else {
You can’t perform that action at this time.
0 commit comments