zio / zio-schema

Compositional, type-safe schema definitions, which enable auto-derivation of codecs and migrations.
https://zio.dev/zio-schema
Apache License 2.0
141 stars 161 forks source link

Implement Protobuf code generator #82

Open jdegoes opened 3 years ago

jdegoes commented 3 years ago

Given a protobuf, it should be possible to generate both the Scala data structure, as well as the Schema corresponding to this data structure.

jdegoes commented 3 years ago

Thinking about this more, it might lead to a better user experience if, instead of generating a Scala case class, we simply use macros to generate a Schema[A] for an existing Scala data type A, from a probobuf, or fail at compile-time if this is not possible.

e.g.:

implicit val personSchema: Schema[Person] = ProtobufDeriveSchema.gen[Person](protobuf)