feat: set version as Kestra version in openapi spec (#12932)

This commit is contained in:
YannC
2025-11-13 14:30:47 +01:00
committed by GitHub
parent 08c2335723
commit c9559b60ca
2 changed files with 29 additions and 2 deletions

View File

@@ -47,3 +47,31 @@ dependencies {
testImplementation("io.micronaut.sql:micronaut-jooq")
}
tasks.register('updateOpenapiVersion') {
dependsOn processResources
doLast {
def openapiFilePath = "${buildDir}/classes/java/main/META-INF/swagger/kestra.yml"
def openapiFile = file(openapiFilePath)
if (openapiFile.exists()) {
def originalText = openapiFile.text
def updatedText = originalText.replace('version: 1.0.0', "version: ${project.version}")
if (updatedText != originalText) {
openapiFile.text = updatedText
println "Successfully updated 'version' in $openapiFilePath to ${project.version}"
} else {
println "Warning: Did not find 'version: 1.0.0' to replace in $openapiFilePath. Check OpenAPI generator output."
}
} else {
println "Error: OpenAPI file not found at $openapiFilePath. Skipping version update."
}
}
}
tasks.named('jar') {
dependsOn updateOpenapiVersion
}

View File

@@ -9,8 +9,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
@OpenAPIDefinition(
info = @Info(
title = "Kestra",
license = @License(name = "Apache 2.0", url = "https://raw.githubusercontent.com/kestra-io/kestra/master/LICENSE"),
version = "v1"
license = @License(name = "Apache 2.0", url = "https://raw.githubusercontent.com/kestra-io/kestra/master/LICENSE")
),
tags = {
@Tag(name = "Flows", description = "Flows API"),