clesaec commented on code in PR #1775:
URL: https://github.com/apache/avro/pull/1775#discussion_r926456439
##########
lang/rust/avro/src/schema.rs:
##########
@@ -2030,6 +2030,51 @@ mod tests {
assert_eq!(schema_c, schema_c_expected);
}
+ // AVRO-3584 : recursion in type definitions
+ #[test]
+ fn test_recursion_records() {
+ use std::iter::FromIterator;
+
+ // A and B are the same except the name.
+ let schema_str_a = r#"{
+ "name": "A",
+ "type": "record",
+ "fields": [ {"name": "field_one", "type": "B"} ]
+ }"#;
+
+ let schema_str_b = r#"{
+ "name": "B",
+ "type": "record",
+ "fields": [ {"name": "field_one", "type": "A"} ]
+ }"#;
+
+ let list = Schema::parse_list(&[schema_str_a, schema_str_b])
+ .unwrap();
+
+ let schema_a = list
+ .first()
+ .unwrap()
+ .clone();
+ let schema_b = list
+ .get(1)
+ .unwrap()
+ .clone();
+
+ match schema_a {
+ Schema::Record { fields, .. } => {
+ let f1 = fields.get(0);
+ let string = f1.unwrap().schema.canonical_form();
Review Comment:
removed
--
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]