https://github.com/burdiyan/schemagen
Generate Go code from Avro schemas stored in Confluent Schema Registry
https://github.com/burdiyan/schemagen
avro code-generation confluent go golang kafka schema schema-registry
Last synced: about 1 month ago
JSON representation
Generate Go code from Avro schemas stored in Confluent Schema Registry
- Host: GitHub
- URL: https://github.com/burdiyan/schemagen
- Owner: burdiyan
- Created: 2018-02-07T15:52:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T13:57:41.000Z (about 5 years ago)
- Last Synced: 2025-05-12T13:11:41.767Z (about 1 month ago)
- Topics: avro, code-generation, confluent, go, golang, kafka, schema, schema-registry
- Language: Go
- Homepage:
- Size: 1.25 MB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**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.
---
# Schemagen [](https://godoc.org/github.com/burdiyan/schemagen)
This is a tool that fetches Avro schemas from [Confluent Schema Registry](https://github.com/confluentinc/schema-registry) and compiles them to Go code.
Code generation is entirely based on [gogen-avro](https://github.com/alanctgardner/gogen-avro).
Additionally, `schemagen` will generate [goka.Codec](https://godoc.org/github.com/lovoo/goka#Codec) compatible type for all Avro schemas of type `record`.
## Installation
Right now the only way to install `schemagen` is to build it from source:
```
go install github.com/burdiyan/schemagen/cmd/...
```## Getting Started
1. Create a file named `.schemagen.yaml` in the root of your project.
2. Specify Schema Registry URL, subjects and versions of the schema you want to download and compile.
3. Run `schemagen` to download the schemas from Schema Registry and compile them.### Config Example
```
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
```