1- // Copyright 2022 Oxide Computer Company
1+ // Copyright 2025 Oxide Computer Company
22
33use std:: { any:: type_name, collections:: HashSet } ;
44
@@ -12,7 +12,7 @@ use syn::{
1212 FieldsNamed , FieldsUnnamed , File , Type , TypePath , TypeTuple , Variant ,
1313} ;
1414
15- use crate :: { output:: OutputSpace , Name , RefKey , TypeId , TypeSpace } ;
15+ use crate :: { output:: OutputSpace , RefKey , TypeId , TypeSpace } ;
1616
1717pub ( crate ) fn get_type < T : JsonSchema > ( ) -> ( TypeSpace , TypeId ) {
1818 let schema = schema_for ! ( T ) ;
@@ -141,40 +141,6 @@ fn decanonicalize_std_types(mut input: DeriveInput) -> DeriveInput {
141141 input
142142}
143143
144- #[ macro_export]
145- macro_rules! validate_builtin {
146- ( $t: ty) => {
147- $crate:: test_util:: validate_builtin_impl:: <$t>( stringify!( $t) )
148- } ;
149- }
150-
151- #[ track_caller]
152- pub ( crate ) fn validate_builtin_impl < T : JsonSchema > ( name : & str ) {
153- let schema = schema_for ! ( T ) ;
154- let original_schema = schemars:: schema:: Schema :: Object ( schema. schema . clone ( ) ) ;
155-
156- let mut type_space = TypeSpace :: default ( ) ;
157- type_space
158- . add_ref_types ( schema. definitions . clone ( ) )
159- . unwrap ( ) ;
160- let ( ty, _) = type_space
161- . convert_schema_object ( Name :: Unknown , & original_schema, & schema. schema )
162- . unwrap ( ) ;
163-
164- let output = ty. type_ident ( & type_space, & None ) ;
165-
166- let actual = syn:: parse2 :: < syn:: Type > ( output. clone ( ) ) . unwrap ( ) ;
167- let expected = syn:: parse_str :: < syn:: Type > ( name) . unwrap ( ) ;
168-
169- // Make sure they match.
170- if let Err ( err) = expected. syn_cmp ( & actual, false ) {
171- println ! ( "{:#?}" , schema) ;
172- println ! ( "actual: {}" , output) ;
173- println ! ( "expected: {}" , name) ;
174- panic ! ( "{}" , err) ;
175- }
176- }
177-
178144pub ( crate ) trait SynCompare {
179145 fn syn_cmp ( & self , other : & Self , ignore_variant_names : bool ) -> Result < ( ) , String > ;
180146}
0 commit comments