Skip to content

Instantly share code, notes, and snippets.

@davidmc24
Last active June 29, 2018 14:00
Show Gist options
  • Save davidmc24/98faf1c41ee0e8725198eaafdc61064e to your computer and use it in GitHub Desktop.
Save davidmc24/98faf1c41ee0e8725198eaafdc61064e to your computer and use it in GitHub Desktop.
Sample project demonstrating gradle-avro-plugin validateDefaults feature
.gradle/
*.iml
*.ipr
*.iws
.idea/
out/
apply plugin: 'java'
apply plugin: 'idea'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.commercehub.gradle.plugin:gradle-avro-plugin:0.14.2"
}
}
apply plugin: "com.commercehub.gradle.plugin.avro"
avro {
validateDefaults = true
}
repositories {
jcenter()
}
dependencies {
compile "org.apache.avro:avro:1.8.2"
}
generateAvroJava {
source(rootDir) // Include avro source in root directory only because Gist doesn't support directories
}
{"namespace": "example.avro",
"type": "record",
"name": "User",
"fields": [
{"name": "name", "type": "string", "default": null},
{"name": "favorite_number", "type": ["int", "null"]},
{"name": "favorite_color", "type": ["string", "null"]},
{
"name": "salary",
"type": { "type": "bytes", "logicalType": "decimal", "precision": 4, "scale": 2 }
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment