[
https://issues.apache.org/jira/browse/AVRO-3483?focusedWorklogId=754988&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-754988
]
ASF GitHub Bot logged work on AVRO-3483:
----------------------------------------
Author: ASF GitHub Bot
Created on: 10/Apr/22 02:22
Start Date: 10/Apr/22 02:22
Worklog Time Spent: 10m
Work Description: jklamer commented on code in PR #1636:
URL: https://github.com/apache/avro/pull/1636#discussion_r846702626
##########
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:
Is there an assertion that the validation is logging for these tests? Do we
need to keep them logging for other builds?
Issue Time Tracking
-------------------
Worklog Id: (was: 754988)
Time Spent: 50m (was: 40m)
> [Rust] Log error messages with a reason when the validation fails
> -----------------------------------------------------------------
>
> Key: AVRO-3483
> URL: https://issues.apache.org/jira/browse/AVRO-3483
> Project: Apache Avro
> Issue Type: Improvement
> Components: rust
> Reporter: Martin Tzvetanov Grigorov
> Assignee: Martin Tzvetanov Grigorov
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Currently types::Value::validate(Schema) just returns a boolean with the
> result of the validation.
> It would be good if the Rust SDK logs the reason for a failed validation.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)