@@ -356,6 +356,37 @@ impl<F: FnMut(Change)> DiffWalker<F> {
356356 Ok ( ( ) )
357357 }
358358
359+ fn diff_format ( & mut self , json_path : & str , lhs : & mut SchemaObject , rhs : & mut SchemaObject ) {
360+ match ( & lhs. format , & rhs. format ) {
361+ ( Some ( lhs_fmt) , Some ( rhs_fmt) ) if lhs_fmt != rhs_fmt => {
362+ ( self . cb ) ( Change {
363+ path : json_path. to_owned ( ) ,
364+ change : ChangeKind :: FormatChange {
365+ old_format : lhs_fmt. clone ( ) ,
366+ new_format : rhs_fmt. clone ( ) ,
367+ } ,
368+ } ) ;
369+ }
370+ ( Some ( removed_fmt) , None ) => {
371+ ( self . cb ) ( Change {
372+ path : json_path. to_owned ( ) ,
373+ change : ChangeKind :: FormatRemove {
374+ removed : removed_fmt. clone ( ) ,
375+ } ,
376+ } ) ;
377+ }
378+ ( None , Some ( added_fmt) ) => {
379+ ( self . cb ) ( Change {
380+ path : json_path. to_owned ( ) ,
381+ change : ChangeKind :: FormatAdd {
382+ added : added_fmt. clone ( ) ,
383+ } ,
384+ } ) ;
385+ }
386+ _ => { } // No change or both None
387+ }
388+ }
389+
359390 fn resolve_references (
360391 & self ,
361392 lhs : & mut SchemaObject ,
@@ -464,6 +495,7 @@ impl<F: FnMut(Change)> DiffWalker<F> {
464495 self . diff_instance_types ( json_path, lhs, rhs) ;
465496 }
466497 self . diff_const ( json_path, lhs, rhs) ;
498+ self . diff_format ( json_path, lhs, rhs) ;
467499 // If we split the types, we don't want to compare type-specific properties
468500 // because they are already compared in the `Self::diff_any_of`
469501 if !is_lhs_split && !is_rhs_split {
0 commit comments