Last active
June 29, 2018 14:00
-
-
Save davidmc24/98faf1c41ee0e8725198eaafdc61064e to your computer and use it in GitHub Desktop.
Sample project demonstrating gradle-avro-plugin validateDefaults feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.gradle/ | |
*.iml | |
*.ipr | |
*.iws | |
.idea/ | |
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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