{"id":22093212,"url":"https://github.com/iadvize/sbt-avro","last_synced_at":"2025-07-04T07:35:24.676Z","repository":{"id":75919017,"uuid":"102839718","full_name":"iadvize/sbt-avro","owner":"iadvize","description":"Plugin SBT to Generate Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.","archived":false,"fork":false,"pushed_at":"2018-03-14T10:36:16.000Z","size":30,"stargazers_count":15,"open_issues_count":2,"forks_count":6,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-01T16:52:01.335Z","etag":null,"topics":["avro","generating","plugin","sbt","sbt-avro","scala","schema","schema-registry"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iadvize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-08T08:45:50.000Z","updated_at":"2021-12-06T08:30:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"07d56357-59d7-4679-b574-baaee3731e79","html_url":"https://github.com/iadvize/sbt-avro","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iadvize/sbt-avro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fsbt-avro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fsbt-avro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fsbt-avro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fsbt-avro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iadvize","download_url":"https://codeload.github.com/iadvize/sbt-avro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iadvize%2Fsbt-avro/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263469472,"owners_count":23471532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avro","generating","plugin","sbt","sbt-avro","scala","schema","schema-registry"],"created_at":"2024-12-01T03:13:17.407Z","updated_at":"2025-07-04T07:35:24.666Z","avatar_url":"https://github.com/iadvize.png","language":"Scala","readme":"# sbt-avro\n\nsbt-avro is a sbt 1.x plugin for generating Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.\n\n## Examples\nExample of build.sbt file:\n```scala\n\n    schemaRegistryEndpoint in Avro := \"http://0.0.0.0:8081\",\n    schemas in Avro ++= Seq(\n        Schema(\"cc_payments-value\", Version(1)),\n        Schema(\"telecom_italia_data-value\", Version(3)),\n        Schema(\"nyc_yellow_taxi_trip_data-value\", Version(1))\n    )\n\n```\n\n## Install\n\nAdd the plugin to your build, eg in `./project/plugins.sbt` add this line:\n\n```scala\naddSbtPlugin(\"com.iadvize\" % \"sbt-avro\" % \"1.0.0-SNAPSHOT\")\n```\n\n### Download Avro schema files from Schema Registry\n\nBy 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/`).\nPlease check settings section for more information about available settings.\n\nExample:\n```scala\nsbt avro:download\n```\n\n### Upload Avro schema files to Schema Registry\n\nsbt-avro can upload all Avro Schema files from your resources directory (ie: `src/main/resources/avro`) to a local schema registry.\nPlease check settings section for more information about available settings.\n\nExample:\n```scala\nsbt avro:upload\n```\n\n### Test compatibility of schemas with their latest versions in Schema Registry\n\nsbt-avro can test schemas for compatibility against the latest version of a subject's schema. This makes use of the \nSchema Registry [compatibility](https://docs.confluent.io/current/schema-registry/docs/api.html#id1) resource.\n\nThe plugin will look for `*.avsc` files in :\n- Resources folder (ie: `src/main/resources/avro/`)\n- Resources Managed folder (ie: `target/scala-2.12/resources_managed/main/avro/`)\n\nExample:\n```scala\nsbt avro:compatibility\n```\n\n### Generate scala classes from Avro schema files\n\nThe plugin sbt-avro will look for `*.avsc` files in :\n- Resources folder (ie: `src/main/resources/avro/`)\n- Resources Managed folder (ie: `target/scala-2.12/resources_managed/main/avro/`)\n\nImportant : 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.\n\nSo put your schema files there and run:\n\n```scala\nsbt avro:generate\n```\n\nThe case classes will get generated in your default src_managed directory (ie:`target/scala-2.12/src_managed/main/avro/`).\n\n## Documentation\n\n### Settings\n\nName | Default | Description\n-----|---------|------------\nschemaRegistryEndpoint | ``localhost:8081`` | Schema Registry endpoint\nschemas | All Avro schemas (with last version) | A list of (subject, version)\nresourceManagedDirectory | ``$resourceManaged/main/avro`` | Path containing *.avsc files from schema registry.\nsourceManagedDirectory | ``$sourceManaged/main/avro`` | Path for the generated *.scala files\nresourceDirectory | ``$resource/main/avro`` | Path containing your *.avs files.\ntemplateDirectory | ``internal`` | Path containing the templates.\n\n\n#### Tasks\n\nTask                                    | Description\n----------------------------------------|----------------------------------------\ndownload                                | Download Avro schemas from a Schema Registry\ngenerate                                | Generate case classes from avro files\nupload                                  | Upload Avro schemas to a Schema Registry\ncompatibility                           | Test compatibility of Avro schemas against their latest versions in a Schema Registry\n\nImportant: `sbt:compile` task will only call avro:generate and not call download task.\n\n#### Custom Templates\n\nYou can use your custom templates to generate scala source from Avro schema.\nIf you want to use custom templates, please add your custom templates into `$templateDirectory` folder.\nTemplate example:\n```velocity\n#if ($schema.getNamespace())\npackage $schema.getNamespace()\n#end\n\n#if ($schema.getDoc())\n/** $schema.getDoc() */\n#end\nobject ${this.mangle($schema.getName())} extends Enumeration {\n\n  val Schema = \"${this.javaEscape($schema.toString())}\"\n\n  val #foreach ($symbol in ${schema.getEnumSymbols()})${this.mangle($symbol)}#if ($velocityHasNext), #end#end = Value\n\n}\n\n```\n\n## Contribute\n\nLook at contribution guidelines here : [CONTRIBUTING.md](CONTRIBUTING.md)\n\n### Contributors\n\n- [Victor Pirat](https://github.com/atvictor)\n- [Jocelyn Dréan](https://github.com/jocelyndrean)\n- [Ian Duffy](https://github.com/imduffy15)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fsbt-avro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiadvize%2Fsbt-avro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiadvize%2Fsbt-avro/lists"}