@@ -73,7 +73,7 @@ fn validate_output_impl<T: JsonSchema + Schema>(ignore_variant_names: bool) {
7373
7474 let expected = T :: schema ( ) ;
7575
76- // A few test cases use structs that use the fully-qualified path to a std type like
76+ // A few test cases use structs that use the fully-qualified path to a std type such as
7777 // `::std::collections::HashMap`. Decanonicalize those types so that later in this function
7878 // when we also decanonicalize the types generated by typify, we can compare the two and expect
7979 // their ASTs to match exactly
@@ -104,18 +104,16 @@ fn validate_output_impl<T: JsonSchema + Schema>(ignore_variant_names: bool) {
104104/// is reasonable to expect that the generated Rust binding matches exactly the Rust type from
105105/// which the JSON Schema was generated.
106106///
107- /// The code generation logic that generates Rust bindings given JSON Schema always canonicalizes
107+ /// Our code generation logic, always canonicalizes
108108/// any standard type (eg, `Option` is output as `::std::option::Option`), to avoid potential
109109/// conflicts with types in the JSON schema with conflicting names like `Option`. Unfortunately,
110- /// this complicates the test cases that start with a Rust type that implements `JsonSchema`, use
111- /// that to generate a JSON schema for that type, then use typify to generate a Rust binding for
112- /// that type, and expects that the Rust AST for the source type and the generated type are exactly
113- /// the same.
110+ /// this complicates the test cases that validate that a round-trip from Rust to JSON back to Rust
111+ /// are exactly the same.
114112///
115113/// To work around this, this somewhat inelegant function simply finds every type in the input AST
116114/// that starts with `::std`, and strips everything but the simple type name. This will break if
117- /// any of the input Rust types ever use fully-qualified type names that start with `::std`, but
118- /// the solution is to simply not do that :)
115+ /// any of the input Rust types use fully-qualified type names that start with `::std`, but
116+ /// the solution is to simply not do that.
119117fn decanonicalize_std_types ( mut input : DeriveInput ) -> DeriveInput {
120118 struct Visitor ;
121119
0 commit comments