@@ -77,23 +77,22 @@ impl Validator {
7777 }
7878
7979 /// A comprehensive document type based validation of the `CatalystSignedDocument`.
80- /// Includes time based validation of the `id` and `ver` fields based on the provided
81- /// `future_threshold` and `past_threshold` threshold values (in seconds).
82- /// Return true if it is valid, otherwise return false.
80+ /// If something fails `doc.report()` would be properly filled, so
81+ /// `doc.report().is_problematic()` would return `false`.
8382 ///
8483 /// # Errors
8584 /// If `provider` returns error, fails fast throwing that error.
8685 pub fn validate (
8786 & self ,
8887 doc : & CatalystSignedDocument ,
8988 provider : & impl Provider ,
90- ) -> anyhow:: Result < bool > {
89+ ) -> anyhow:: Result < ( ) > {
9190 let Ok ( doc_type) = doc. doc_type ( ) else {
9291 doc. report ( ) . missing_field (
9392 "type" ,
9493 "Can't get a document type during the validation process" ,
9594 ) ;
96- return Ok ( false ) ;
95+ return Ok ( ( ) ) ;
9796 } ;
9897
9998 let Some ( rules) = self . 0 . get ( doc_type) else {
@@ -103,16 +102,15 @@ impl Validator {
103102 "Must be a known document type value" ,
104103 "Unsupported document type" ,
105104 ) ;
106- return Ok ( false ) ;
105+ return Ok ( ( ) ) ;
107106 } ;
108107
109- let res = rules
108+ rules
110109 . iter ( )
111110 . map ( |v| v. check ( doc, provider) )
112- . collect :: < anyhow:: Result < Vec < _ > > > ( ) ?
113- . iter ( )
114- . all ( |res| * res) ;
115- Ok ( res)
111+ . collect :: < anyhow:: Result < Vec < _ > > > ( ) ?;
112+
113+ Ok ( ( ) )
116114 }
117115
118116 /// Extend the current defined validation rules set for the provided document type.
0 commit comments