You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "PookieBuns (via GitHub)" <gi...@apache.org> on 2025/11/20 19:25:44 UTC
[PR] fix: Choose correct schema when serializing an Option [avro-rs]
PookieBuns opened a new pull request, #337:
URL: https://github.com/apache/avro-rs/pull/337
There is a bug currently in serialization in which if you are serializing an Option<Enum> for a Union Schema (with null), it will automatically try to use the first not-null schema if you choose a not-null enum. This fix allows the serializer to correctly resolve the proper schema to serialize the Enum variant with.
## Notes
- This changes the error message for the Union Long test. Imo its now better because it properly shows the expected type vs the attempted type instead of showing the Union as the error. Because of this, I had to change the test assert message to allow it to pass
- Serializing unions containing records are a bit funky right now, since structs in rust should be in Capital case but if the name is not in Capital case, you have to rename the struct itself, instead of calling ex. `camelCase` on the Enum. However, this is pre-existing behavior so its not a regression from pre-existing behavior
Please let me know if there are any questions or things to address!
--
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: dev-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on PR #337:
URL: https://github.com/apache/avro-rs/pull/337#issuecomment-3559912192
What would a nested option map to in terms of an avro schema?
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 merged PR #337:
URL: https://github.com/apache/avro-rs/pull/337
--
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: dev-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 commented on PR #337:
URL: https://github.com/apache/avro-rs/pull/337#issuecomment-3559788796
I was about to comment if the entire loop cannot be removed, but you already removed it๐.
I do have a concern about how this handles nested Options, if you provide a Some(None) won't it use the Schema::Null from the outer Union?
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "Kriskras99 (via GitHub)" <gi...@apache.org>.
Kriskras99 commented on PR #337:
URL: https://github.com/apache/avro-rs/pull/337#issuecomment-3559952421
Ah, that would map to a nested Union which is not allowed by spec, so we don't need to worry about that.
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "martin-g (via GitHub)" <gi...@apache.org>.
martin-g commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547647543
##########
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());
+ let mut buffer: Vec<u8> = Vec::new();
+ let rs = ResolvedSchema::try_from(&schema)?;
+ let mut serializer =
+ SchemaAwareWriteSerializer::new(&mut buffer, &schema, rs.get_names(), None);
+
+ let foo_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantFoo(InnerRecordFoo {
+ foo: String::from("foo"),
+ }),
+ };
+ foo_record.serialize(&mut serializer)?;
+ let bar_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantBar(InnerRecordBar {
+ bar: String::from("bar"),
+ }),
+ };
+ bar_record.serialize(&mut serializer)?;
+ let int_record = TestRecord {
+ inner_union: InnerUnion::IntField(1),
+ };
+ int_record.serialize(&mut serializer)?;
+ let string_record = TestRecord {
+ inner_union: InnerUnion::StringField(String::from("string")),
+ };
+ string_record.serialize(&mut serializer)?;
+ Ok(())
+ }
+
+ #[test]
+ fn test_serialize_option_union_record_variant() -> TestResult {
+ let schema = Schema::parse_str(
+ r#"{
+ "type": "record",
+ "name": "TestRecord",
+ "fields": [{
+ "name": "innerUnion", "type": [
+ "null",
+ {"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: Option<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:
```suggestion
assert!(!crate::util::is_human_readable(), "Some nice message here please");
```
##########
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());
+ let mut buffer: Vec<u8> = Vec::new();
+ let rs = ResolvedSchema::try_from(&schema)?;
+ let mut serializer =
+ SchemaAwareWriteSerializer::new(&mut buffer, &schema, rs.get_names(), None);
+
+ let foo_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantFoo(InnerRecordFoo {
+ foo: String::from("foo"),
+ }),
+ };
+ foo_record.serialize(&mut serializer)?;
+ let bar_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantBar(InnerRecordBar {
+ bar: String::from("bar"),
+ }),
+ };
+ bar_record.serialize(&mut serializer)?;
+ let int_record = TestRecord {
+ inner_union: InnerUnion::IntField(1),
+ };
+ int_record.serialize(&mut serializer)?;
+ let string_record = TestRecord {
+ inner_union: InnerUnion::StringField(String::from("string")),
+ };
+ string_record.serialize(&mut serializer)?;
+ Ok(())
+ }
+
+ #[test]
+ fn test_serialize_option_union_record_variant() -> TestResult {
Review Comment:
```suggestion
fn avro_rs_337_serialize_option_union_record_variant() -> TestResult {
```
##########
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:
```suggestion
assert!(!crate::util::is_human_readable(), "Some nice message here please");
```
##########
avro/src/ser_schema.rs:
##########
@@ -2770,4 +2745,161 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_serialize_union_record_variant() -> TestResult {
Review Comment:
```suggestion
fn avro_rs_337_serialize_union_record_variant() -> TestResult {
```
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on PR #337:
URL: https://github.com/apache/avro-rs/pull/337#issuecomment-3560329323
There's another edge case I just uncovered that will fail tests. Will update to try to fix.
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547876965
##########
avro/src/ser_schema.rs:
##########
@@ -2770,4 +2745,161 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_serialize_union_record_variant() -> TestResult {
Review Comment:
Do you want `avro_rs_337` for both `serialize_union_record` as well as `serialize_option_union_record`?
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547941647
##########
avro/src/ser_schema.rs:
##########
@@ -2770,4 +2745,161 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_serialize_union_record_variant() -> TestResult {
Review Comment:
Updated!
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547876965
##########
avro/src/ser_schema.rs:
##########
@@ -2770,4 +2745,161 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_serialize_union_record_variant() -> TestResult {
Review Comment:
Do you want `avro_rs_337` for both `serialize_union_record` as well as `serialize_option_union_record`?
--
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-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Choose correct schema when serializing an Option [avro-rs]
Posted by "PookieBuns (via GitHub)" <gi...@apache.org>.
PookieBuns commented on code in PR #337:
URL: https://github.com/apache/avro-rs/pull/337#discussion_r2547943321
##########
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());
+ let mut buffer: Vec<u8> = Vec::new();
+ let rs = ResolvedSchema::try_from(&schema)?;
+ let mut serializer =
+ SchemaAwareWriteSerializer::new(&mut buffer, &schema, rs.get_names(), None);
+
+ let foo_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantFoo(InnerRecordFoo {
+ foo: String::from("foo"),
+ }),
+ };
+ foo_record.serialize(&mut serializer)?;
+ let bar_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantBar(InnerRecordBar {
+ bar: String::from("bar"),
+ }),
+ };
+ bar_record.serialize(&mut serializer)?;
+ let int_record = TestRecord {
+ inner_union: InnerUnion::IntField(1),
+ };
+ int_record.serialize(&mut serializer)?;
+ let string_record = TestRecord {
+ inner_union: InnerUnion::StringField(String::from("string")),
+ };
+ string_record.serialize(&mut serializer)?;
+ Ok(())
+ }
+
+ #[test]
+ fn test_serialize_option_union_record_variant() -> TestResult {
Review Comment:
Updated!
##########
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());
+ let mut buffer: Vec<u8> = Vec::new();
+ let rs = ResolvedSchema::try_from(&schema)?;
+ let mut serializer =
+ SchemaAwareWriteSerializer::new(&mut buffer, &schema, rs.get_names(), None);
+
+ let foo_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantFoo(InnerRecordFoo {
+ foo: String::from("foo"),
+ }),
+ };
+ foo_record.serialize(&mut serializer)?;
+ let bar_record = TestRecord {
+ inner_union: InnerUnion::InnerVariantBar(InnerRecordBar {
+ bar: String::from("bar"),
+ }),
+ };
+ bar_record.serialize(&mut serializer)?;
+ let int_record = TestRecord {
+ inner_union: InnerUnion::IntField(1),
+ };
+ int_record.serialize(&mut serializer)?;
+ let string_record = TestRecord {
+ inner_union: InnerUnion::StringField(String::from("string")),
+ };
+ string_record.serialize(&mut serializer)?;
+ Ok(())
+ }
+
+ #[test]
+ fn test_serialize_option_union_record_variant() -> TestResult {
+ let schema = Schema::parse_str(
+ r#"{
+ "type": "record",
+ "name": "TestRecord",
+ "fields": [{
+ "name": "innerUnion", "type": [
+ "null",
+ {"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: Option<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:
Similar to above, 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: issues-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org