Open jakoss opened 2 years ago
I think this is related to https://github.com/swagger-api/swagger-core/issues/3854 and it's a killer for me. I'm stuck on 5.1.1 until this gets fixed
Same issue with
plugins {
id "org.openapi.generator" version "5.3.0"
}
It is the same with 5.3.1
version, any updates?
I managed to work around the issue with the following setup
root build.gradle.kts file:
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
// Other dependencies and stuff here
classpath("org.openapitools:openapi-generator-gradle-plugin:5.3.1") {
exclude(group = "com.fasterxml.jackson.core")
}
classpath("com.fasterxml.jackson.core:jackson-databind:2.13.1")
}
}
build.gradle.kts file in whatever module contains the configuration code for the openApi plugin
plugins {
// Other plugins here.
id("org.openapi.generator") //note: no version since we already declared it to be 5.3.1
}
// example plugin config further down in the same build.gradle.kts file
openApiValidate {
inputSpec.set("${project.rootDir}/openapi.json")
recommend.set(true)
}
Hi there! In my case (kotlin, gradle 7.4) root cause was in using older version of com.fasterxml.jackson.core:jackson-databind by another package so below helped me: Was:
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.2")
Changed to:
implementation("org.springframework.boot:spring-boot-starter-web") {
exclude("com.fasterxml.jackson.core:jackson-databind")
}
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.2")
implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.2")
implementation("com.fasterxml.jackson.core:jackson-core:2.13.2")
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.2.2")
Also ./gradlew service:dependencyInsight --dependency com.fasterxml.jackson.core:jackson-databind
was suitable to identify source of dependency
Another workaround without excludes is to pin the version with stricktly
:
buildscript {
repositories { /*..*/ }
dependencies {
classpath("com.fasterxml.jackson.core:jackson-databind") {
version{ strictly("2.11.3") }
}
classpath("org.openapitools:openapi-generator:6.2.0")
}
}
It is important that the pinning is done before adding the plugin classpath
today I have the same issue
I have the same issue with openapi 6.2.1 and my project depends on jackson
2.13.2
.
None of the proposed workaround work for me, i.e. does have any effect.
I've tried to pin the version of jackson-databind
to 2.13.4
as proposed by @Onvistlex , and then
gradle buildEnvironment
shows a dependency tree in which all jackson artifacts have version 2.13.4
but task openapiGenerate
still fails with exactly this exception.
I had the same issue, because forgot add to project build.gradle.kts
file line into plugins block:
plugins {
alias(libs.plugins.openapi.generator) apply false
}
libs.versions.toml
[versions]
openapiGeneratorPlugin = "7.3.0"
[plugins]
openapi-generator = { id = "org.openapi.generator", version.ref = "openapiGeneratorPlugin" }
Description
This issue is with gradle plugin. After upgrading it from 5.1.1 to 5.2.0 i have this error while trying to generate models:
openapi-generator version
5.2.0. Downgrading to 5.1.1 fixes the issue
OpenAPI declaration file content or url
Unfortunately i cannot provide swagger file due to client policies. But since this is a regression and seems to be connected to jackson dependency i don't think the declaration is necessary.
Generation Details
Full generation configuration: