diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 53a291cdc026c..b6e6815d5a1b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,7 +31,7 @@ jgit = "6.10.0.202406032230-r" jiraRestClient = "5.2.7" jruby = "9.4.7.0" jslt = "0.1.14" -jsonSchemaValidator = "1.4.0" +jsonSchemaValidator = "1.4.2" kotest = "5.9.1" kotlinxCoroutines = "1.8.1" kotlinxHtml = "0.11.0" diff --git a/model/src/test/kotlin/JsonSchemaTest.kt b/model/src/test/kotlin/JsonSchemaTest.kt index ee65f1f4ce868..8d30fc904171a 100644 --- a/model/src/test/kotlin/JsonSchemaTest.kt +++ b/model/src/test/kotlin/JsonSchemaTest.kt @@ -21,6 +21,7 @@ package org.ossreviewtoolkit.model import com.networknt.schema.JsonSchemaFactory import com.networknt.schema.SpecVersion +import com.networknt.schema.serialization.JsonNodeReader import io.kotest.core.spec.style.StringSpec import io.kotest.inspectors.forAll @@ -105,9 +106,11 @@ class JsonSchemaTest : StringSpec({ } }) +private val nodeReader = JsonNodeReader.builder().yamlMapper(yamlMapper).build() + private val schemaV7 = JsonSchemaFactory .builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7)) - .yamlMapper(yamlMapper) + .jsonNodeReader(nodeReader) .build() private val repositoryConfigurationSchema = diff --git a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt index 7de4ab07a5287..75b67fe8d4f1a 100644 --- a/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt +++ b/plugins/reporters/spdx/src/funTest/kotlin/SpdxDocumentReporterFunTest.kt @@ -21,6 +21,7 @@ package org.ossreviewtoolkit.plugins.reporters.spdx import com.networknt.schema.JsonSchemaFactory import com.networknt.schema.SpecVersion +import com.networknt.schema.serialization.JsonNodeReader import io.kotest.core.TestConfiguration import io.kotest.core.spec.style.WordSpec @@ -70,15 +71,15 @@ import org.ossreviewtoolkit.utils.test.scannerRunOf class SpdxDocumentReporterFunTest : WordSpec({ "Reporting to JSON" should { "create a valid document" { - val jsonMapper = FileFormat.JSON.mapper + val nodeReader = JsonNodeReader.builder().jsonMapper(FileFormat.JSON.mapper).build() val schema = JsonSchemaFactory .builder(JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7)) - .jsonMapper(FileFormat.JSON.mapper) + .jsonNodeReader(nodeReader) .build() .getSchema(getAssetFile("spdx-schema.json").toURI()) val jsonSpdxDocument = generateReport(ortResult, FileFormat.JSON) - val errors = schema.validate(jsonMapper.readTree(jsonSpdxDocument)) + val errors = schema.validate(FileFormat.JSON.mapper.readTree(jsonSpdxDocument)) errors should beEmpty() }