Skip to content

Commit db0be60

Browse files
committed
Generate getter annotation to address FasterXML/jackson-module-kotlin#630
1 parent cc41504 commit db0be60

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plugin/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = "com.github.raymank26"
8-
version = project.findProperty("version")?.takeIf { it != "unspecified" } ?: "1.13-SNAPSHOT"
8+
version = project.findProperty("version")?.takeIf { it != "unspecified" } ?: "1.14-SNAPSHOT"
99

1010
repositories {
1111
mavenCentral()

plugin/src/main/kotlin/com/github/raymank26/TypesGenerator.kt

+6
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,17 @@ class TypesGenerator(
184184
.addMember("%S", property.name)
185185
.useSiteTarget(AnnotationSpec.UseSiteTarget.FIELD)
186186
.build()
187+
val jsonPropertyGetter = AnnotationSpec
188+
.builder(ClassName("com.fasterxml.jackson.annotation", "JsonProperty"))
189+
.addMember("%S", property.name)
190+
.useSiteTarget(AnnotationSpec.UseSiteTarget.GET)
191+
.build()
187192
PropertySpec
188193
.builder(property.name.decapitalized(), generateTypeDescriptor(property.type, property.required))
189194
.initializer(property.name.decapitalized())
190195
.addAnnotation(jsonProperty)
191196
.addAnnotation(jsonPropertyField)
197+
.addAnnotation(jsonPropertyGetter)
192198
.build()
193199
}.toMutableList()
194200
if (properties.isEmpty()) {

0 commit comments

Comments
 (0)