You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2022/02/03 09:44:26 UTC

[avro] branch master updated: Fix broken link in README.md

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new 69fda12  Fix broken link in README.md
69fda12 is described below

commit 69fda12c5f3695504e15851b9028cc57efa4c90e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Thu Feb 3 11:42:44 2022 +0200

    Fix broken link in README.md
    
    Remove a link to an issue/PR at flavray/avro-rs/pull/76 because it is
    already resolved. Enable (uncomment) the tests related to this issue.
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 lang/rust/README.md                   |   7 +-
 lang/rust/src/lib.rs                  |   3 -
 lang/rust/src/schema_compatibility.rs | 196 ++++++++++++++++------------------
 3 files changed, 97 insertions(+), 109 deletions(-)

diff --git a/lang/rust/README.md b/lang/rust/README.md
index 4c562f7..c319ce2 100644
--- a/lang/rust/README.md
+++ b/lang/rust/README.md
@@ -22,9 +22,9 @@
 [![Latest Version](https://img.shields.io/crates/v/apache-avro.svg)](https://crates.io/crates/apache-avro)
 [![Rust Continuous Integration](https://github.com/apache/avro/actions/workflows/test-lang-rust-ci.yml/badge.svg)](https://github.com/apache/avro/actions/workflows/test-lang-rust-ci.yml)
 [![Latest Documentation](https://docs.rs/apache-avro/badge.svg)](https://docs.rs/apache-avro)
-[![Apache License 2.0](https://img.shields.io/badge/license-Apache%202-blue.svg](https://github.com/apache/avro/blob/master/LICENSE.txt)
+[![Apache License 2.0](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/apache/avro/blob/master/LICENSE.txt)
 
-A library for working with [Apache Avro](https://avro.apache.org/) in Rust.
+A library for working with [Apache Avro](https://avro.apache.org/) in Rust language.
 
 Please check our [documentation](https://docs.rs/apache-avro) for examples, tutorials and API reference.
 
@@ -614,9 +614,6 @@ max_allocation_bytes(2 * 1024 * 1024 * 1024);  // 2GB
 
 This library supports checking for schemas compatibility.
 
-Note: It does not yet support named schemas (more on
-https://github.com/flavray/apache-avro/pull/76).
-
 Examples of checking for compatibility:
 
 1. Compatible schemas
diff --git a/lang/rust/src/lib.rs b/lang/rust/src/lib.rs
index 3b140ce..8b271d6 100644
--- a/lang/rust/src/lib.rs
+++ b/lang/rust/src/lib.rs
@@ -692,9 +692,6 @@
 //!
 //! This library supports checking for schemas compatibility.
 //!
-//! Note: It does not yet support named schemas (more on
-//! <https://github.com/flavray/avro-rs/pull/76>).
-//!
 //! Examples of checking for compatibility:
 //!
 //! 1. Compatible schemas
diff --git a/lang/rust/src/schema_compatibility.rs b/lang/rust/src/schema_compatibility.rs
index 7c815e0..b3fb4db 100644
--- a/lang/rust/src/schema_compatibility.rs
+++ b/lang/rust/src/schema_compatibility.rs
@@ -763,20 +763,17 @@ mod tests {
         assert!(SchemaCompatibility::can_read(&enum_schema1, &enum_schema2));
     }
 
-    // unused
-    /*
-        fn point_2d_schema() -> Schema {
-            Schema::parse_str(
-                r#"
-          {"type":"record", "name":"Point2D", "fields":[
-            {"name":"x", "type":"double"},
-            {"name":"y", "type":"double"}
-          ]}
-        "#,
-            )
-            .unwrap()
-        }
-    */
+    fn point_2d_schema() -> Schema {
+        Schema::parse_str(
+            r#"
+      {"type":"record", "name":"Point2D", "fields":[
+        {"name":"x", "type":"double"},
+        {"name":"y", "type":"double"}
+      ]}
+    "#,
+        )
+        .unwrap()
+    }
 
     fn point_2d_fullname_schema() -> Schema {
         Schema::parse_str(
@@ -803,34 +800,31 @@ mod tests {
         .unwrap()
     }
 
-    // unused
-    /*
-        fn point_3d_schema() -> Schema {
-            Schema::parse_str(
-                r#"
-          {"type":"record", "name":"Point3D", "fields":[
-            {"name":"x", "type":"double"},
-            {"name":"y", "type":"double"},
-            {"name":"z", "type":"double", "default": 0.0}
-          ]}
-        "#,
-            )
-            .unwrap()
-        }
+    fn point_3d_schema() -> Schema {
+        Schema::parse_str(
+            r#"
+      {"type":"record", "name":"Point3D", "fields":[
+        {"name":"x", "type":"double"},
+        {"name":"y", "type":"double"},
+        {"name":"z", "type":"double", "default": 0.0}
+      ]}
+    "#,
+        )
+        .unwrap()
+    }
 
-        fn point_3d_match_name_schema() -> Schema {
-            Schema::parse_str(
-                r#"
-          {"type":"record", "name":"Point", "fields":[
-            {"name":"x", "type":"double"},
-            {"name":"y", "type":"double"},
-            {"name":"z", "type":"double", "default": 0.0}
-          ]}
-        "#,
-            )
-            .unwrap()
-        }
-    */
+    fn point_3d_match_name_schema() -> Schema {
+        Schema::parse_str(
+            r#"
+      {"type":"record", "name":"Point", "fields":[
+        {"name":"x", "type":"double"},
+        {"name":"y", "type":"double"},
+        {"name":"z", "type":"double", "default": 0.0}
+      ]}
+    "#,
+        )
+        .unwrap()
+    }
 
     #[test]
     fn test_union_resolution_no_structure_match() {
@@ -842,64 +836,64 @@ mod tests {
         ));
     }
 
-    // TODO(nlopes): the below require named schemas to be fully supported. See:
-    // https://github.com/flavray/avro-rs/pull/76
-    //
-    // #[test]
-    // fn test_union_resolution_first_structure_match_2d() {
-    //     // multiple structure matches with no name matches
-    //     let read_schema = union_schema(vec![
-    //         Schema::Null,
-    //         point_3d_no_default_schema(),
-    //         point_2d_schema(),
-    //         point_3d_schema(),
-    //     ]);
-    //     assert!(
-    //         !SchemaCompatibility::can_read(&point_2d_fullname_schema(), &read_schema)
-    //     );
-    // }
-
-    // #[test]
-    // fn test_union_resolution_first_structure_match_3d() {
-    //     // multiple structure matches with no name matches
-    //     let read_schema = union_schema(vec![
-    //         Schema::Null,
-    //         point_3d_no_default_schema(),
-    //         point_3d_schema(),
-    //         point_2d_schema(),
-    //     ]);
-    //     assert!(
-    //         !SchemaCompatibility::can_read(&point_2d_fullname_schema(), &read_schema)
-    //     );
-    // }
-
-    // #[test]
-    // fn test_union_resolution_named_structure_match() {
-    //     // multiple structure matches with a short name match
-    //     let read_schema = union_schema(vec![
-    //         Schema::Null,
-    //         point_2d_schema(),
-    //         point_3d_match_name_schema(),
-    //         point_3d_schema(),
-    //     ]);
-    //     assert!(
-    //         !SchemaCompatibility::can_read(&point_2d_fullname_schema(), &read_schema)
-    //     );
-    // }
-
-    // #[test]
-    // fn test_union_resolution_full_name_match() {
-    //     // there is a full name match that should be chosen
-    //     let read_schema = union_schema(vec![
-    //         Schema::Null,
-    //         point_2d_schema(),
-    //         point_3d_match_name_schema(),
-    //         point_3d_schema(),
-    //         point_2d_fullname_schema(),
-    //     ]);
-    //     assert!(SchemaCompatibility::can_read(
-    //         &point_2d_fullname_schema(),
-    //         &read_schema
-    //     ));
-    // }
+    #[test]
+    fn test_union_resolution_first_structure_match_2d() {
+        // multiple structure matches with no name matches
+        let read_schema = union_schema(vec![
+            Schema::Null,
+            point_3d_no_default_schema(),
+            point_2d_schema(),
+            point_3d_schema(),
+        ]);
+        assert!(!SchemaCompatibility::can_read(
+            &point_2d_fullname_schema(),
+            &read_schema
+        ));
+    }
+
+    #[test]
+    fn test_union_resolution_first_structure_match_3d() {
+        // multiple structure matches with no name matches
+        let read_schema = union_schema(vec![
+            Schema::Null,
+            point_3d_no_default_schema(),
+            point_3d_schema(),
+            point_2d_schema(),
+        ]);
+        assert!(!SchemaCompatibility::can_read(
+            &point_2d_fullname_schema(),
+            &read_schema
+        ));
+    }
+
+    #[test]
+    fn test_union_resolution_named_structure_match() {
+        // multiple structure matches with a short name match
+        let read_schema = union_schema(vec![
+            Schema::Null,
+            point_2d_schema(),
+            point_3d_match_name_schema(),
+            point_3d_schema(),
+        ]);
+        assert!(!SchemaCompatibility::can_read(
+            &point_2d_fullname_schema(),
+            &read_schema
+        ));
+    }
+
+    #[test]
+    fn test_union_resolution_full_name_match() {
+        // there is a full name match that should be chosen
+        let read_schema = union_schema(vec![
+            Schema::Null,
+            point_2d_schema(),
+            point_3d_match_name_schema(),
+            point_3d_schema(),
+            point_2d_fullname_schema(),
+        ]);
+        assert!(SchemaCompatibility::can_read(
+            &point_2d_fullname_schema(),
+            &read_schema
+        ));
+    }
 }