Bug Report Checklist
Description
7.25.0 breaks backward compatibility, by force-setting useJackson3=true for Spring 4 and jvm-spring-restclient
It's incorrect to enforce Jackson 3 with those settings: Spring 4.0 and 4.1 work with Jackson 2, it's just deprecated. RestClient still works with Jackson 2.
openapi-generator version
7.25.0, it's a regression compared to 7.24.0
OpenAPI declaration file content or url
Generation Details
See 'steps to reproduce'
Steps to reproduce
I only generate sources and use my own build.gradle.kts, throwing away generator's one.
dependencies {
api(platform("org.springframework.boot:spring-boot-dependencies:4.0.8"))
api("org.springframework:spring-web")
// api because Serializer.jacksonObjectMapper is public
api("com.fasterxml.jackson.core:jackson-databind")
api("org.openapitools:jackson-databind-nullable:0.2.11")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
}
openApiGenerate {
configOptions.set(
mapOf(
"omitGradleWrapper" to "true",
"library" to "jvm-spring-restclient",
"useSpringBoot3" to "true",
"useSpringBoot4" to "true",
"useJackson3" to "false",
"serializationLibrary" to "jackson",
)
)
}
What complied with 7.24.0, fails to compile in 7.25.0 because Serializer.kt is now:
import tools.jackson.databind.DeserializationFeature
import tools.jackson.databind.json.JsonMapper
import tools.jackson.databind.cfg.DateTimeFeature
import com.fasterxml.jackson.annotation.JsonInclude
import tools.jackson.module.kotlin.jsonMapper
import tools.jackson.module.kotlin.kotlinModule
object Serializer {
@JvmStatic
val jacksonObjectMapper: JsonMapper = jsonMapper {
addModule(kotlinModule())
changeDefaultPropertyInclusion { it.withValueInclusion(JsonInclude.Include.NON_ABSENT) }
disable(DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS)
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
}
}
Because I explicitly set useJackson3=false, the generated code should import com.fasterxml.jackson
Related issues/PRs
#24709
Suggest a fix
Remove the addition of setUseJackson3(true) as pointed out in https://github.com/OpenAPITools/openapi-generator/pull/24709/changes#r3917417022
Bug Report Checklist
Description
7.25.0 breaks backward compatibility, by force-setting useJackson3=true for Spring 4 and
jvm-spring-restclientIt's incorrect to enforce Jackson 3 with those settings: Spring 4.0 and 4.1 work with Jackson 2, it's just deprecated. RestClient still works with Jackson 2.
openapi-generator version
7.25.0, it's a regression compared to 7.24.0
OpenAPI declaration file content or url
Generation Details
See 'steps to reproduce'
Steps to reproduce
I only generate sources and use my own build.gradle.kts, throwing away generator's one.
What complied with 7.24.0, fails to compile in 7.25.0 because Serializer.kt is now:
Because I explicitly set
useJackson3=false, the generated code should importcom.fasterxml.jacksonRelated issues/PRs
#24709
Suggest a fix
Remove the addition of
setUseJackson3(true)as pointed out in https://github.com/OpenAPITools/openapi-generator/pull/24709/changes#r3917417022