martin-g commented on code in PR #460:
URL: https://github.com/apache/avro-rs/pull/460#discussion_r2795454340


##########
avro/src/schema/mod.rs:
##########
@@ -5147,6 +5158,58 @@ mod tests {
             error,
             Details::ParsePrimitiveSimilar("bool".to_string(), 
"boolean").to_string()
         );
+
+        Ok(())
+    }
+
+    #[test]
+    fn avro_rs_460_fixed_default_in_custom_attributes() -> TestResult {
+        let schema = Schema::parse_str(
+            r#"{
+            "name": "fixed_with_default",
+            "type": "fixed",
+            "size": 1,
+            "default": "\u0000",
+            "doc": "a docstring"
+        }"#,
+        )?;
+
+        assert_eq!(schema.custom_attributes().unwrap(), &BTreeMap::new());
+
+        let json = serde_json::to_string(&schema)?;
+        let schema2 = Schema::parse_str(&json)?;
+
+        let Schema::Fixed(fixed) = schema2 else {
+            panic!("Expected Schema::Fixed, got {schema2:?}");
+        };
+        assert!(fixed.default.is_some());
+
+        Ok(())
+    }
+
+    #[test]
+    fn avro_rs_460_enum_default_in_custom_attributes() -> TestResult {
+        let schema = Schema::parse_str(
+            r#"{
+            "name": "fixed_with_default",
+            "type": "enum",
+            "symbols": ["A", "B", "C"],
+            "default": "A",
+            "doc": "a docstring"
+        }"#,
+        )?;
+
+        assert_eq!(schema.custom_attributes().unwrap(), &BTreeMap::new());
+
+        let json = serde_json::to_string(&schema)?;
+        let schema2 = Schema::parse_str(&json)?;
+
+        let Schema::Enum(enum_schema) = schema2 else {
+            panic!("Expected Schema::Fixed, got {schema2:?}");

Review Comment:
   ```suggestion
               panic!("Expected Schema::Enum, got {schema2:?}");
   ```



##########
avro/src/schema/mod.rs:
##########
@@ -5147,6 +5158,58 @@ mod tests {
             error,
             Details::ParsePrimitiveSimilar("bool".to_string(), 
"boolean").to_string()
         );
+
+        Ok(())
+    }
+
+    #[test]
+    fn avro_rs_460_fixed_default_in_custom_attributes() -> TestResult {

Review Comment:
   Why the name of the method is `in_custom_attributes` ?
   `ssert_eq!(schema.custom_attributes().unwrap(), &BTreeMap::new());` verifies 
that it is not there



-- 
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