martin-g commented on code in PR #1636:
URL: https://github.com/apache/avro/pull/1636#discussion_r846866511


##########
lang/rust/avro/src/types.rs:
##########
@@ -878,15 +979,65 @@ mod tests {
                 false,
             ),
             (Value::Record(vec![]), Schema::Null, false),
+            (
+                Value::Fixed(12, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]),
+                Schema::Duration,
+                true,
+            ),
+            (
+                Value::Fixed(11, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]),
+                Schema::Duration,
+                false,
+            ),
+            (
+                Value::Record(vec![("unknown_field_name".to_string(), 
Value::Null)]),
+                Schema::Record {
+                    name: Name::new("record_name").unwrap(),
+                    aliases: None,
+                    doc: None,
+                    fields: vec![RecordField {
+                        name: "field_name".to_string(),
+                        doc: None,
+                        default: None,
+                        schema: Schema::Int,
+                        order: RecordFieldOrder::Ignore,
+                        position: 0,
+                    }],
+                    lookup: Default::default(),
+                },
+                false,
+            ),
+            (
+                Value::Record(vec![("field_name".to_string(), Value::Null)]),
+                Schema::Record {
+                    name: Name::new("record_name").unwrap(),
+                    aliases: None,
+                    doc: None,
+                    fields: vec![RecordField {
+                        name: "field_name".to_string(),
+                        doc: None,
+                        default: None,
+                        schema: Schema::Ref {
+                            name: Name::new("missing").unwrap(),
+                        },
+                        order: RecordFieldOrder::Ignore,
+                        position: 0,
+                    }],
+                    lookup: Default::default(),
+                },
+                false,
+            ),
         ];
 
         for (value, schema, valid) in value_schema_valid.into_iter() {
-            assert_eq!(valid, value.validate(&schema));
+            assert_eq!(valid, value.validate_internal(&schema, 
&HashMap::default()));
         }
     }
 
     #[test]
     fn validate_fixed() {
+        init();

Review Comment:
   I've implemented a custom Logger that stores the logged messages in a thread 
local Vec!
   
   > Do we need to keep them logging for other builds?
   
   You mean whether we need to log the errors at all ?
   I think it is useful because the application will most probably log them 
too, so that the developer could fix the problematic Avro records.
   
   At the moment apache_avro lib uses `log` crate APIs. The error messages are 
logged only if the application provides an Impl like `env_logger`, as we do in 
the tests



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