All Projects â†’ iadvize â†’ sbt-avro

iadvize / sbt-avro

Licence: MIT, MIT licenses found Licenses found MIT LICENSE MIT LICENSE.txt
Plugin SBT to Generate Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sbt-avro

schema-registry
📙 json & avro http schema registry backed by Kafka
Stars: ✭ 23 (+53.33%)
Mutual labels:  schema, avro, schema-registry
Schema Registry
Confluent Schema Registry for Kafka
Stars: ✭ 1,647 (+10880%)
Mutual labels:  schema, avro, schema-registry
avro turf
A library that makes it easier to use the Avro serialization format from Ruby.
Stars: ✭ 130 (+766.67%)
Mutual labels:  schema, avro, schema-registry
confluent-spark-avro
Spark UDFs to deserialize Avro messages with schemas stored in Schema Registry.
Stars: ✭ 18 (+20%)
Mutual labels:  avro, schema-registry
avrora
A convenient Elixir library to work with Avro schemas and Confluent® Schema Registry
Stars: ✭ 59 (+293.33%)
Mutual labels:  avro, schema-registry
dotnet-avro
An Avro implementation for .NET
Stars: ✭ 60 (+300%)
Mutual labels:  avro, schema-registry
srclient
Golang Client for Schema Registry
Stars: ✭ 188 (+1153.33%)
Mutual labels:  schema, avro
avrow
Avrow is a pure Rust implementation of the avro specification https://avro.apache.org/docs/current/spec.html with Serde support.
Stars: ✭ 27 (+80%)
Mutual labels:  schema, avro
pulsar-io-kafka
Pulsar IO Kafka Connector
Stars: ✭ 24 (+60%)
Mutual labels:  schema, schema-registry
schema-registry-php-client
A PHP 7.3+ API client for the Confluent Schema Registry REST API based on Guzzle 6 - http://docs.confluent.io/current/schema-registry/docs/index.html
Stars: ✭ 40 (+166.67%)
Mutual labels:  avro, schema-registry
avro ex
An Avro Library that emphasizes testability and ease of use.
Stars: ✭ 47 (+213.33%)
Mutual labels:  schema, avro
Insulator
A client UI to inspect Kafka topics, consume, produce and much more
Stars: ✭ 53 (+253.33%)
Mutual labels:  schema, avro
tamer
Standalone alternatives to Kafka Connect Connectors
Stars: ✭ 42 (+180%)
Mutual labels:  avro, schema-registry
kafka-scala-examples
Examples of Avro, Kafka, Schema Registry, Kafka Streams, Interactive Queries, KSQL, Kafka Connect in Scala
Stars: ✭ 53 (+253.33%)
Mutual labels:  avro, schema-registry
spring-cloud-stream-event-sourcing-testcontainers
Goal: create a Spring Boot application that handles users using Event Sourcing. So, whenever a user is created, updated, or deleted, an event informing this change is sent to Kafka. Also, we will implement another application that listens to those events and saves them in Cassandra. Finally, we will use Testcontainers for integration testing.
Stars: ✭ 16 (+6.67%)
Mutual labels:  avro, schema-registry
Kaufmann ex
Kafka backed service library.
Stars: ✭ 86 (+473.33%)
Mutual labels:  schema, avro
Schema Registry
A CLI and Go client for Kafka Schema Registry
Stars: ✭ 105 (+600%)
Mutual labels:  schema, avro
Graphql Rover
🚀 GraphQL + Vue.js + D3.js schema viewer, powered by introspection.
Stars: ✭ 239 (+1493.33%)
Mutual labels:  schema
graphql-schema-diff
📄🔄📄 Returns the diff of two GraphQL schemas. Detects dangerous and breaking changes.
Stars: ✭ 54 (+260%)
Mutual labels:  schema
Truss
Assertions API for Clojure/Script
Stars: ✭ 239 (+1493.33%)
Mutual labels:  schema

sbt-avro

sbt-avro is a sbt 1.x plugin for generating Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.

Examples

Example of build.sbt file:

    schemaRegistryEndpoint in Avro := "http://0.0.0.0:8081",
    schemas in Avro ++= Seq(
        Schema("cc_payments-value", Version(1)),
        Schema("telecom_italia_data-value", Version(3)),
        Schema("nyc_yellow_taxi_trip_data-value", Version(1))
    )

Install

Add the plugin to your build, eg in ./project/plugins.sbt add this line:

addSbtPlugin("com.iadvize" % "sbt-avro" % "1.0.0-SNAPSHOT")

Download Avro schema files from Schema Registry

By default sbt-avro will download all Avro schema files from local schema registry to your default resources_managed directory (ie: target/scala-2.12/resources_managed/main/avro/). Please check settings section for more information about available settings.

Example:

sbt avro:download

Upload Avro schema files to Schema Registry

sbt-avro can upload all Avro Schema files from your resources directory (ie: src/main/resources/avro) to a local schema registry. Please check settings section for more information about available settings.

Example:

sbt avro:upload

Test compatibility of schemas with their latest versions in Schema Registry

sbt-avro can test schemas for compatibility against the latest version of a subject's schema. This makes use of the Schema Registry compatibility resource.

The plugin will look for *.avsc files in :

  • Resources folder (ie: src/main/resources/avro/)
  • Resources Managed folder (ie: target/scala-2.12/resources_managed/main/avro/)

Example:

sbt avro:compatibility

Generate scala classes from Avro schema files

The plugin sbt-avro will look for *.avsc files in :

  • Resources folder (ie: src/main/resources/avro/)
  • Resources Managed folder (ie: target/scala-2.12/resources_managed/main/avro/)

Important : If a duplicate avro schema (same name ) is detected in your resources folder and in your resources_managed folder, the compiler will compile only the schema in resources folder. So, for example, in dev if you want to try some local changes, you can duplicate your schema from your resources managed folder into your resources folder and compile your changes.

So put your schema files there and run:

sbt avro:generate

The case classes will get generated in your default src_managed directory (ie:target/scala-2.12/src_managed/main/avro/).

Documentation

Settings

Name Default Description
schemaRegistryEndpoint localhost:8081 Schema Registry endpoint
schemas All Avro schemas (with last version) A list of (subject, version)
resourceManagedDirectory $resourceManaged/main/avro Path containing *.avsc files from schema registry.
sourceManagedDirectory $sourceManaged/main/avro Path for the generated *.scala files
resourceDirectory $resource/main/avro Path containing your *.avs files.
templateDirectory internal Path containing the templates.

Tasks

Task Description
download Download Avro schemas from a Schema Registry
generate Generate case classes from avro files
upload Upload Avro schemas to a Schema Registry
compatibility Test compatibility of Avro schemas against their latest versions in a Schema Registry

Important: sbt:compile task will only call avro:generate and not call download task.

Custom Templates

You can use your custom templates to generate scala source from Avro schema. If you want to use custom templates, please add your custom templates into $templateDirectory folder. Template example:

#if ($schema.getNamespace())
package $schema.getNamespace()
#end

#if ($schema.getDoc())
/** $schema.getDoc() */
#end
object ${this.mangle($schema.getName())} extends Enumeration {

  val Schema = "${this.javaEscape($schema.toString())}"

  val #foreach ($symbol in ${schema.getEnumSymbols()})${this.mangle($symbol)}#if ($velocityHasNext), #end#end = Value

}

Contribute

Look at contribution guidelines here : CONTRIBUTING.md

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].