From ec1b082fc007363782165e3f1bc351fee92d05df Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 14 May 2026 13:55:09 +0200 Subject: [PATCH 1/2] test(common): Decouple schema validation from Jackson ORT's `yamlMapper` uses Jackson 2, but an upcoming version of the JSON schema validator will use Jackson 3. Signed-off-by: Sebastian Schuberth --- workers/common/src/test/kotlin/JsonSchemaTest.kt | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/workers/common/src/test/kotlin/JsonSchemaTest.kt b/workers/common/src/test/kotlin/JsonSchemaTest.kt index 7fe722fd97..4102a486cc 100644 --- a/workers/common/src/test/kotlin/JsonSchemaTest.kt +++ b/workers/common/src/test/kotlin/JsonSchemaTest.kt @@ -19,9 +19,9 @@ package org.eclipse.apoapsis.ortserver.workers.common +import com.networknt.schema.InputFormat import com.networknt.schema.SchemaRegistry import com.networknt.schema.SpecificationVersion -import com.networknt.schema.serialization.NodeReader import io.kotest.core.spec.style.WordSpec import io.kotest.inspectors.forAll @@ -31,8 +31,6 @@ import io.kotest.matchers.shouldNot import java.io.File -import org.ossreviewtoolkit.model.yamlMapper - class JsonSchemaTest : WordSpec({ val validConfigs = File("src/test/resources") .walk().maxDepth(1) @@ -46,7 +44,7 @@ class JsonSchemaTest : WordSpec({ "successfully validate all valid .ort.env.yml files" { @Suppress("IgnoredReturnValue") validConfigs.forAll { file -> - val errors = schema.validate(file.toJsonNode()) + val errors = schema.validate(file.readText(), InputFormat.YAML) errors should beEmpty() } @@ -57,7 +55,7 @@ class JsonSchemaTest : WordSpec({ // treated as invalid by the JSON schema validator. @Suppress("IgnoredReturnValue") invalidConfigs.forAll { file -> - val errors = schema.validate(file.toJsonNode()) + val errors = schema.validate(file.readText(), InputFormat.YAML) errors shouldNot beEmpty() } @@ -65,13 +63,8 @@ class JsonSchemaTest : WordSpec({ } }) -private fun File.toJsonNode() = yamlMapper.readTree(inputStream()) - -private val nodeReader = NodeReader.builder().yamlMapper(yamlMapper).build() - private val schemaV7 = SchemaRegistry .builder(SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_7)) - .nodeReader(nodeReader) .build() private val schema = schemaV7.getSchema( From 7277c471dbc162ff01295b42869dde852408ea2e Mon Sep 17 00:00:00 2001 From: eclipse-apoapsis-bot <159786767+eclipse-apoapsis-bot@users.noreply.github.com> Date: Thu, 14 May 2026 11:06:18 +0000 Subject: [PATCH 2/2] deps: update com.networknt:json-schema-validator to v3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fc8049c875..fecf89334f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -40,7 +40,7 @@ commonsText = "1.15.0" exposed = "1.2.0" flyway = "12.6.1" hikari = "7.0.2" -jsonSchemaValidator = "2.0.1" +jsonSchemaValidator = "3.0.2" kaml = "0.104.0" keycloakTestcontainerVersion = "4.2.1" koin = "4.2.1"