chupaty commented on code in PR #66:
URL: https://github.com/apache/avro-rs/pull/66#discussion_r1881337192


##########
avro/src/schema.rs:
##########
@@ -3238,7 +3304,7 @@ mod tests {
         assert_eq!(schema, expected);
 
         let canonical_form = &schema.canonical_form();
-        let expected = 
r#"{"name":"record","type":"record","fields":[{"name":"enum","type":{"name":"enum","type":"enum","symbols":["one","two","three"]}},{"name":"next","type":{"name":"enum","type":"enum","symbols":["one","two","three"]}}]}"#;
+        let expected = 
r#"{"name":"record","type":"record","fields":[{"name":"enum","type":{"name":"enum","type":"enum","symbols":["one","two","three"]}},{"name":"next","type":"enum"}]}"#;

Review Comment:
   This test was originally added with the update to the spec clarifying the 
use of certain names (ie 'enum' and 'fixed' for this and the following test). 
   
   https://github.com/apache/avro/pull/1573/files
   
   This test refers to a field named 'enum' with a type of 'enum' - fine.  The 
change here is necessary because the old canonical_form() incorrectly defined 
the type _twice_, which is not allowed by the spec:
   
   > A schema or protocol may not contain multiple definitions of a fullname. 
Further, a name must be defined before it is used ("before" in the depth-first, 
left-to-right traversal of the JSON parse tree, where the types attribute of a 
protocol is always deemed to come "before" the messages attribute.)
   
   canonical_form() now tracks the types as the schema is traversed, so it 
trims out the already defined type to meet the define-once rule.



-- 
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: issues-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to