y0psolo commented on code in PR #46:
URL: https://github.com/apache/iceberg-rust/pull/46#discussion_r1310304947


##########
crates/iceberg/src/spec/schema.rs:
##########
@@ -705,6 +734,36 @@ mod tests {
     use crate::spec::schema::_serde::SchemaV2;
     use std::collections::HashMap;
 
+    fn check_schema_serde(json: &str, expected_type: Schema) {
+        let desered_type: Schema = serde_json::from_str(json).unwrap();
+        assert_eq!(desered_type, expected_type);
+
+        let sered_json = serde_json::to_string(&expected_type).unwrap();
+        assert_eq!(sered_json, json);
+        let parsed_json_value = 
serde_json::from_str::<Schema>(&sered_json).unwrap();
+
+        assert_eq!(parsed_json_value, desered_type);
+    }
+
+    #[test]
+    fn test_serde() {

Review Comment:
   Done, I implemented a test with schema-id set and with schema-id unset. I 
also added a check to be sure that V1 or V2 enum is correctly chosen depending 
if schema-id is set or unset.
   I change the test schema to rely on the existing table_simple_schema already 
existing instead of relying on other one
   I also tied the json string to table_simple_schema so that if we change the 
function, we also know we need to change the json string accordingly



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to