Theodlz commented on issue #435:
URL: https://github.com/apache/avro-rs/issues/435#issuecomment-3795677477
Ok, so here is the original bug mentioned in this issue, reproduced:
```rust
use apache_avro::{AvroSchema, Writer};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, AvroSchema)]
pub enum Color { G, R, I }
#[derive(Deserialize, Serialize, AvroSchema)]
pub struct A {
pub time: f64,
pub color: Color,
}
#[derive(Deserialize, Serialize, AvroSchema)]
pub struct B {
pub time: f64,
pub color: Option<Color>,
}
#[derive(Deserialize, Serialize, AvroSchema)]
pub struct C {
#[serde(flatten)]
pub a: A,
}
#[derive(Deserialize, Serialize, AvroSchema)]
pub struct TestStruct {
pub b: B,
pub vec_c: Vec<C>,
}
fn main() {
let test = TestStruct {
b: B { time: 42.0, color: Some(Color::R) },
vec_c: vec![],
};
let schema = TestStruct::get_schema();
let mut writer = Writer::with_codec(
&schema,
Vec::new(),
apache_avro::Codec::Snappy,
)
.unwrap();
writer.append_ser(test).unwrap();
}
```
So here, the problem is that this `Color` type is occurring twice in the
generated schema, which yields: `Error { details: Two named schema defined for
same fullname: Color. }`.
--
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]