martin-g commented on code in PR #2742:
URL: https://github.com/apache/avro/pull/2742#discussion_r1495490719
##########
lang/rust/avro/src/schema_compatibility.rs:
##########
@@ -430,97 +429,54 @@ impl SchemaCompatibility {
if let Schema::Map(w_m) = writers_schema {
if let Schema::Map(r_m) = readers_schema {
return
SchemaCompatibility::match_schemas(&w_m.types, &r_m.types);
- } else {
- return Err(CompatibilityError::TypeExpected {
- schema_type: String::from("readers_schema"),
- expected_type: vec![SchemaKind::Map],
- });
}
- } else {
+
return Err(CompatibilityError::TypeExpected {
- schema_type: String::from("writers_schema"),
+ schema_type: String::from("readers_schema"),
expected_type: vec![SchemaKind::Map],
});
}
+
+ return Err(CompatibilityError::TypeExpected {
+ schema_type: String::from("writers_schema"),
+ expected_type: vec![SchemaKind::Map],
+ });
}
SchemaKind::Array => {
if let Schema::Array(w_a) = writers_schema {
if let Schema::Array(r_a) = readers_schema {
return
SchemaCompatibility::match_schemas(&w_a.items, &r_a.items);
- } else {
- return Err(CompatibilityError::TypeExpected {
- schema_type: String::from("readers_schema"),
- expected_type: vec![SchemaKind::Array],
- });
}
- } else {
+
return Err(CompatibilityError::TypeExpected {
- schema_type: String::from("writers_schema"),
+ schema_type: String::from("readers_schema"),
expected_type: vec![SchemaKind::Array],
});
}
+
+ return Err(CompatibilityError::TypeExpected {
+ schema_type: String::from("writers_schema"),
+ expected_type: vec![SchemaKind::Array],
+ });
}
- SchemaKind::Date => {
- return check_writer_type(
- writers_schema,
- Schema::Date,
- vec![SchemaKind::Date, SchemaKind::Int],
- );
- }
- SchemaKind::TimeMillis => {
+ SchemaKind::Date | SchemaKind::TimeMillis => {
return check_writer_type(
writers_schema,
- Schema::TimeMillis,
+ readers_schema,
vec![SchemaKind::Date, SchemaKind::Int],
Review Comment:
Here we have the same problem as below.
The first item in the vec must be `r_type`
--
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]