Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properties with list of values #152

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename json to jsonProps in AnnotationExtractor
  • Loading branch information
franckrasolo committed Aug 25, 2023
commit c1e5e802c60b49da0244800676229ab8b074c412
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class AnnotationExtractor(private val annotations: List<Annotation>) {
annotations.filterIsInstance<AvroAliases>().flatMap { it.value.toList() }
}
fun props(): List<Pair<String, String>> = annotations.filterIsInstance<AvroProp>().map { it.key to it.value }
fun json(): List<Pair<String, String>> = annotations.filterIsInstance<AvroJsonProp>().map { it.key to it.jsonValue }
fun jsonProps(): List<Pair<String, String>> = annotations.filterIsInstance<AvroJsonProp>().map { it.key to it.jsonValue }
fun default(): String? = annotations.filterIsInstance<AvroDefault>().firstOrNull()?.value
fun enumDefault(): String? = annotations.filterIsInstance<AvroEnumDefault>().firstOrNull()?.value
}

Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ClassSchemaFor(
record.fields = fields
entityAnnotations.aliases().forEach { record.addAlias(it) }
entityAnnotations.props().forEach { (k, v) -> record.addProp(k, v) }
entityAnnotations.json().forEach { (k, v) -> record.addProp(k, json.parseToJsonElement(v).convertToAvroDefault()) }
entityAnnotations.jsonProps().forEach { (k, v) -> record.addProp(k, json.parseToJsonElement(v).convertToAvroDefault()) }

return record
}
Expand Down