PookieBuns commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547942840
##########
avro/src/ser_schema.rs:
##########
@@ -2770,4 +2745,161 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_serialize_union_record_variant() -> TestResult {
+ let schema = Schema::parse_str(
+ r#"{
+ "type": "record",
+ "name": "TestRecord",
+ "fields": [{
+ "name": "innerUnion", "type": [
+ {"type": "record", "name": "innerRecordFoo", "fields": [
+ {"name": "foo", "type": "string"}
+ ]},
+ {"type": "record", "name": "innerRecordBar", "fields": [
+ {"name": "bar", "type": "string"}
+ ]},
+ {"name": "intField", "type": "int"},
+ {"name": "stringField", "type": "string"}
+ ]
+ }]
+ }"#,
+ )?;
+
+ #[derive(Serialize)]
+ #[serde(rename_all = "camelCase")]
+ struct TestRecord {
+ inner_union: InnerUnion,
+ }
+
+ #[derive(Serialize)]
+ #[serde(untagged)]
+ enum InnerUnion {
+ InnerVariantFoo(InnerRecordFoo),
+ InnerVariantBar(InnerRecordBar),
+ IntField(i32),
+ StringField(String),
+ }
+
+ #[derive(Serialize)]
+ #[serde(rename = "innerRecordFoo")]
+ struct InnerRecordFoo {
+ foo: String,
+ }
+
+ #[derive(Serialize)]
+ #[serde(rename = "innerRecordBar")]
+ struct InnerRecordBar {
+ bar: String,
+ }
+
+ assert!(!crate::util::is_human_readable());
Review Comment:
I just removed it since it doesn't apply to this test because we aren't
asserting bytes
--
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]