THIS PACKAGE IS DEPRECATED
Since I ended up ditching Avro in favor of Protobuf for everything I do, this repo is not mantained anymore. I would accept fixes and PRs if someone wanted to fix something.
This is a tool that fetches Avro schemas from Confluent Schema Registry and compiles them to Go code.
Code generation is entirely based on gogen-avro.
Additionally, schemagen
will generate goka.Codec compatible type for all Avro schemas of type record
.
Right now the only way to install schemagen
is to build it from source:
go install github.com/burdiyan/schemagen/cmd/...
- Create a file named
.schemagen.yaml
in the root of your project. - Specify Schema Registry URL, subjects and versions of the schema you want to download and compile.
- Run
schemagen
to download the schemas from Schema Registry and compile them.
kind: Avro
registry: http://confluent-schema-registry.default.svc.cluster.local:8081
schemas:
- subject: my-topic-value
version: latest
package: country # This is the name of the Go package that will be generated.
- subject: another-topic-value
version: "2"
package: anothertopic
compile: true
outputDir: ./foo