Skip to content

Commit

Permalink
Update dependency com.cjbooms:fabrikt to v16
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored and acanda committed May 9, 2024
1 parent 55d875e commit 0a535f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repositories {
}

dependencies {
implementation("com.cjbooms:fabrikt:15.3.0")
implementation("com.cjbooms:fabrikt:16.1.0")
testImplementation(kotlin("test"))
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,12 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({

addIgnoreUnknownPropertiesAnnotation(modelsDirectory)

val modelClass = modelsDirectory.resolve("Animal.kt").readText()
modelClass shouldBe """
// the base class should not be annotated
modelsDirectory.resolve("Animal.kt").readText() shouldBe """
|package a.b.models
|
|import com.fasterxml.jackson.`annotation`.JsonIgnoreProperties
|import com.fasterxml.jackson.`annotation`.JsonProperty
|import com.fasterxml.jackson.`annotation`.JsonSubTypes
|import com.fasterxml.jackson.`annotation`.JsonTypeInfo
|import javax.validation.constraints.NotNull
|
|@JsonTypeInfo(
| use = JsonTypeInfo.Id.NAME,
Expand All @@ -92,6 +89,16 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({
| public abstract val type: AnimalDiscriminatorType
|}
|
""".trimMargin()

// only the data classes should be annotated
modelsDirectory.resolve("Dog.kt").readText() shouldBe """
|package a.b.models
|
|import com.fasterxml.jackson.`annotation`.JsonIgnoreProperties
|import com.fasterxml.jackson.`annotation`.JsonProperty
|import javax.validation.constraints.NotNull
|
|@JsonIgnoreProperties(ignoreUnknown = true)
|public data class Dog(
| @get:JsonProperty("type")
Expand All @@ -100,14 +107,6 @@ class IgnoreUnknownPropertiesProcessorTest : StringSpec({
| override val type: AnimalDiscriminatorType = AnimalDiscriminatorType.DOG,
|) : Animal()
|
|@JsonIgnoreProperties(ignoreUnknown = true)
|public data class Cat(
| @get:JsonProperty("type")
| @get:NotNull
| @param:JsonProperty("type")
| override val type: AnimalDiscriminatorType = AnimalDiscriminatorType.CAT,
|) : Animal()
|
""".trimMargin()
}

Expand Down

0 comments on commit 0a535f2

Please sign in to comment.