@@ -24,8 +24,8 @@ macro_rules! traverse_key_fn {
2424macro_rules! traverse {
2525 ( $( $key: expr => $func: expr) ,* ; $dict: expr, $ctx: expr) => { {
2626 $( traverse_key_fn!( $key, $func, $dict, $ctx) ; ) *
27- gather_serialization ( $dict, $ctx) ? ;
28- gather_meta( $dict, $ctx) ? ;
27+ traverse_key_fn! ( "serialization" , gather_serialization , $dict, $ctx) ;
28+ gather_meta( $dict, $ctx)
2929 } }
3030}
3131
@@ -56,7 +56,7 @@ fn gather_definition_ref(schema_ref_dict: &Bound<'_, PyDict>, ctx: &mut GatherCt
5656 ctx. recursively_seen_refs . insert ( schema_ref_str. to_string ( ) ) ;
5757
5858 gather_schema ( definition. downcast_exact :: < PyDict > ( ) ?, ctx) ?;
59- gather_serialization ( schema_ref_dict, ctx) ? ;
59+ traverse_key_fn ! ( "serialization" , gather_serialization , schema_ref_dict, ctx) ;
6060 gather_meta ( schema_ref_dict, ctx) ?;
6161
6262 ctx. recursively_seen_refs . remove ( schema_ref_str) ;
@@ -75,11 +75,7 @@ fn gather_definition_ref(schema_ref_dict: &Bound<'_, PyDict>, ctx: &mut GatherCt
7575}
7676
7777fn gather_serialization ( schema : & Bound < ' _ , PyDict > , ctx : & mut GatherCtx ) -> PyResult < ( ) > {
78- if let Some ( ser) = get ! ( schema, "serialization" ) {
79- let ser_dict = ser. downcast_exact :: < PyDict > ( ) ?;
80- traverse ! ( "schema" => gather_schema, "return_schema" => gather_schema; ser_dict, ctx) ;
81- }
82- Ok ( ( ) )
78+ traverse ! ( "schema" => gather_schema, "return_schema" => gather_schema; schema, ctx)
8379}
8480
8581fn gather_meta ( schema : & Bound < ' _ , PyDict > , ctx : & mut GatherCtx ) -> PyResult < ( ) > {
@@ -133,7 +129,7 @@ fn gather_schema(schema: &Bound<'_, PyDict>, ctx: &mut GatherCtx) -> PyResult<()
133129 return py_err ! ( PyKeyError ; "Schema type missing" ) ;
134130 }
135131 match type_. unwrap ( ) . downcast_exact :: < PyString > ( ) ?. to_str ( ) ? {
136- "definition-ref" => gather_definition_ref ( schema, ctx) ? ,
132+ "definition-ref" => gather_definition_ref ( schema, ctx) ,
137133 "definitions" => traverse ! ( "schema" => gather_schema, "definitions" => gather_list; schema, ctx) ,
138134 "list" | "set" | "frozenset" | "generator" => traverse ! ( "items_schema" => gather_schema; schema, ctx) ,
139135 "tuple" => traverse ! ( "items_schema" => gather_list; schema, ctx) ,
@@ -157,8 +153,7 @@ fn gather_schema(schema: &Bound<'_, PyDict>, ctx: &mut GatherCtx) -> PyResult<()
157153 "computed-field" | "function-plain" => traverse ! ( "return_schema" => gather_schema; schema, ctx) ,
158154 "function-wrap" => traverse ! ( "return_schema" => gather_schema, "schema" => gather_schema; schema, ctx) ,
159155 _ => traverse ! ( "schema" => gather_schema; schema, ctx) ,
160- } ;
161- Ok ( ( ) )
156+ }
162157}
163158
164159pub struct GatherCtx < ' a , ' py > {
0 commit comments