Skip to content

Commit

Permalink
Upgrade openapi plugin version from 7.7 to 7.11.
Browse files Browse the repository at this point in the history
In version 7.7 generating documentation via the openApi gradle task results in the following misleading warning:

"More than one inline schema specified in allOf:. Only the first one is recognized. All others are ignored."

See comments on this PR: OpenAPITools/openapi-generator#19646.

In later versions of the plugin - and rather than fixing the issue - the severity of the warning has been reduced from WARN to DEBUG.  See: https://github.com/OpenAPITools/openapi-generator/pull/19646/files.

Also set removeEnumValuePrefix = true since this is a new additional property added to more recent versions which removes the prefix for enum definitions.  Previously in version 7.7 prefixes were removed automatically and the property didn't exist.  Since it defaults to false we need to set it to true.  See OpenAPITools/openapi-generator#20452.

Unfortunately this property isn't documented in the README https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/kotlin-server.md#config-options.
  • Loading branch information
danhumphreys-moj committed Jan 23, 2025
1 parent 01e5f54 commit d28b330
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import org.apache.commons.io.FileUtils
plugins {
id("uk.gov.justice.hmpps.gradle-spring-boot") version "6.1.0"
kotlin("plugin.spring") version "2.0.20"
id("org.openapi.generator") version "7.7.0"
id("org.openapi.generator") version "7.11.0"
id("org.jetbrains.kotlin.plugin.jpa") version "1.9.22"
id("io.gatling.gradle") version "3.13.1"
id("io.gitlab.arturbosch.detekt") version "1.23.7"
Expand Down Expand Up @@ -239,6 +239,7 @@ openApiGenerate {
typeMappings.put("DateTime", "Instant")
importMappings.put("Instant", "java.time.Instant")
templateDir.set("$rootDir/openapi")
additionalProperties.put("removeEnumValuePrefix", "true")
}

registerAdditionalOpenApiGenerateTask(
Expand Down

0 comments on commit d28b330

Please sign in to comment.