Skip to content

Commit

Permalink
deps: update dependency com.networknt:json-schema-validator to v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored and sschuberth committed Jun 21, 2024
1 parent 6a26070 commit f995050
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion model/src/test/kotlin/JsonSchemaTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit f995050

Please sign in to comment.