Hi Rajiv, Now, when you said it I remembered about this prerequisite for serializing bytes. I will open a PR to rsgen-avro to add #[serde(with = "serde_bytes")] when "bytes" schema is used!
Regards, Martin On Mon, Aug 29, 2022 at 5:10 PM Rajiv M Ranganath <rajiv.rangan...@gmail.com> wrote: > Hi Martin, > > It looks like there are no changes needed on the Avro side. I was not > using Serde correctly. > > On the Rust side, we need to use `serde_bytes` [1] crate, and define our > Rust struct as follows. > > ``` > #[derive(Debug, PartialEq, Eq, Clone, serde::Deserialize, > serde::Serialize)] > #[serde(default)] > pub struct Abcd { > #[serde(with = "serde_bytes")] > pub b: Option<Vec<u8>>, > } > ``` > > That seems to make things work. > > Thanks again for the reply. > > Best, > Rajiv > > [1] https://docs.rs/serde_bytes/latest/serde_bytes/ > > On Mon, Aug 29, 2022 at 5:18 PM Rajiv M Ranganath > <rajiv.rangan...@gmail.com> wrote: > > > > On Mon, Aug 29, 2022 at 3:18 PM Martin Grigorov <mgrigo...@apache.org> > wrote: > > > > [...] > > > > > Do you want to contribute the code as a failing unit test in a Pull > > > Request ? > > > With a fix would be awesome! > > > > Okay. Please give me a couple of days. I'll investigate and open a PR. > > > > Best, > > Rajiv >