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" 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(