@@ -15,15 +15,13 @@ fn resolve_ref<'a>(
1515) -> DiscoveryResult < & ' a Value > {
1616 if !ref_path. starts_with ( "#/" ) {
1717 return Err ( DiscoveryError :: InvalidSchema ( format ! (
18- "$ref '{}' must start with '#/'" ,
19- ref_path
18+ "$ref '{ref_path}' must start with '#/'"
2019 ) ) ) ;
2120 }
2221
2322 if !visited. insert ( ref_path. to_string ( ) ) {
2423 return Err ( DiscoveryError :: InvalidSchema ( format ! (
25- "Cycle detected in $ref path '{}'" ,
26- ref_path
24+ "Cycle detected in $ref path '{ref_path}'"
2725 ) ) ) ;
2826 }
2927
@@ -33,15 +31,13 @@ fn resolve_ref<'a>(
3331 for segment in path {
3432 if segment. is_empty ( ) {
3533 return Err ( DiscoveryError :: InvalidSchema ( format ! (
36- "Invalid $ref path '{}': empty segment" ,
37- ref_path
34+ "Invalid $ref path '{ref_path}': empty segment"
3835 ) ) ) ;
3936 }
4037 current = match current {
4138 Value :: Object ( obj) => obj. get ( segment) . ok_or_else ( || {
4239 DiscoveryError :: InvalidSchema ( format ! (
43- "Invalid $ref path '{}': segment '{}' not found" ,
44- ref_path, segment
40+ "Invalid $ref path '{ref_path}': segment '{segment}' not found"
4541 ) )
4642 } ) ?,
4743 Value :: Array ( arr) => segment
@@ -50,15 +46,13 @@ fn resolve_ref<'a>(
5046 . and_then ( |i| arr. get ( i) )
5147 . ok_or_else ( || {
5248 DiscoveryError :: InvalidSchema ( format ! (
53- "Invalid $ref path '{}': segment '{}' not found in array" ,
54- ref_path, segment
49+ "Invalid $ref path '{ref_path}': segment '{segment}' not found in array"
5550 ) )
5651 } ) ?,
5752 _ => {
5853 return Err ( DiscoveryError :: InvalidSchema ( format ! (
59- "Invalid $ref path '{}': cannot traverse into non-object/array" ,
60- ref_path
61- ) ) )
54+ "Invalid $ref path '{ref_path}': cannot traverse into non-object/array"
55+ ) ) ) ;
6256 }
6357 } ;
6458 }
@@ -91,8 +85,7 @@ pub fn param_object(
9185 let param_value = param_value
9286 . as_object ( )
9387 . ok_or ( DiscoveryError :: InvalidSchema ( format ! (
94- "Property '{}' is not an object" ,
95- param_name
88+ "Property '{param_name}' is not an object"
9689 ) ) ) ?;
9790 let param_type = param_type ( param_value, root_schema, visited) ?;
9891 let param_description = object_map
@@ -127,8 +120,7 @@ pub fn param_type(
127120 let ref_map = ref_value
128121 . as_object ( )
129122 . ok_or ( DiscoveryError :: InvalidSchema ( format ! (
130- "$ref '{}' does not point to an object" ,
131- ref_path_str
123+ "$ref '{ref_path_str}' does not point to an object"
132124 ) ) ) ?;
133125 return param_type ( ref_map, root_schema, visited) ;
134126 }
@@ -154,7 +146,7 @@ pub fn param_type(
154146 return Err ( DiscoveryError :: InvalidSchema ( format ! (
155147 "Unsupported enum value type: {}" ,
156148 serde_json:: to_string( value) . unwrap_or_default( )
157- ) ) )
149+ ) ) ) ;
158150 }
159151 } ;
160152 param_types. push ( param_type) ;
0 commit comments