Hi Jack, On Thu, Mar 3, 2022 at 3:11 AM Jack Klamer <[email protected]> wrote:
> Hello Avro Devs, > > My name is Jack and I used Java Avro a lot in my career and really enjoyed > the "Avro way". I started to program in rust and started to use the Avro > library for rust as well. I have been working on a feature for myself that > Welcome to Avro community! And thank you for offering your help for the Rust SDK! I believe has reached the POC/beta stage. I would love to get it into the > open source but it will need more polishing and documentation, and want to > make sure I propose it here to get alignment/have discussions for certain > aspects. > The proposal: > - Have another rust crate that is importable as a feature on the main crate > (in the same manner as serde derive), that will provide a derive proc_macro > that implements a simple trait that returns the schema for the implementing > type. Right now, schemas must be parsed from strings ( or read from files > first), and closely coordinated with the associated struct. This makes > sense for workflows that need to associate the same type across languages. > For programs that are all within Rust, there are usability advantages of > the proc_macro. > > To see the POC in action please review: > > https://github.com/jklamer/avro/blob/feature/DeriveSchema/lang/rust/avro_derive/tests/derive.rs > > And for slightly more details on thoughts: > > https://github.com/jklamer/avro/blob/feature/DeriveSchema/lang/rust/avro_derive/proposal_supporting_docs.md This looks cool! Are you aware of https://github.com/MaterializeInc/materialize/tree/main/src/avro-derive ? It is Apache 2.0 licenced so we may take inspiration from it. Too bad it does not have a single test case and documentation. I will restructure lang/rust to a Rust workspace as you did to prepare it for more modules, like avro_derive and maybe rsgen-avro ( https://github.com/lerouxrgd/rsgen-avro)! > > > Best, > Jack >
