Repository navigation
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
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
Suggest a fix
Remove the addition of setUseJackson3(true) as pointed out in https://github.com/OpenAPITools/openapi-generator/pull/24709/changes#r3917417022
Activity
Picazsoo commentedon Sep 2, 2026
I agree with your analysis. The fix should be to set
useJackson3=trueas the default whenuseSpringBoot4=true, while still respecting any explicit user configuration. This way:useJackson3=falseto opt-outThe current behavior of forcing
useJackson3=trueand ignoring the user's explicituseJackson3=falsesetting breaks backward compatibility. The generated code should match what the user requests, not override it.[kotlin][client] Respect explicit useJackson3=false with useSpringBoo…
pkubowicz commentedon Oct 7, 2026
Thank you!