Kriskras99 commented on code in PR #397:
URL: https://github.com/apache/avro-rs/pull/397#discussion_r2681762779


##########
avro/src/schema.rs:
##########
@@ -2765,17 +2767,49 @@ pub mod derive {
                 name: "duration".to_string(),
                 namespace: enclosing_namespace.clone(),
             };
-            named_schemas
-                .entry(name.clone())
-                .or_insert(Schema::Duration(FixedSchema {
-                    name,
+            if named_schemas.contains_key(&name) {
+                Schema::Ref { name }
+            } else {
+                let schema = Schema::Duration(FixedSchema {
+                    name: name.clone(),
                     aliases: None,
                     doc: None,
                     size: 12,
                     default: None,
                     attributes: Default::default(),
-                }))
-                .clone()
+                });
+                named_schemas.insert(name.clone(), schema.clone());
+                schema
+            }
+        }
+    }
+
+    impl AvroSchemaComponent for uuid::Uuid {
+        /// The schema is [`Schema::Uuid`] with the name `uuid`.
+        ///
+        /// The underlying schema is [`Schema::Fixed`] with a size of 16.
+        fn get_schema_in_ctxt(
+            named_schemas: &mut Names,
+            enclosing_namespace: &Namespace,
+        ) -> Schema {
+            let name = Name {
+                name: "uuid".to_string(),

Review Comment:
   A user will only see these schemas if they derived `AvroSchema` and have a 
`uuid` or `duration` field. If they have a nameclash somewhere, the can use 
`rename` on the other uuid struct, or `with` on the field with uuid to override 
the schema.
   
   So I think having this as a default is fine, because users can (with this 
PR) override the schema if needed (also if they want the `uuid` `string` 
version)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to