Skip to content

Commit 4c6c2e5

Browse files
committed
deps: Update json-schema-validator version 2.0.0
Signed-off-by: Frank Viernau <[email protected]>
1 parent 2298e80 commit 4c6c2e5

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jgit = "7.4.0.202509020913-r"
3636
jiraRestClient = "7.0.1"
3737
jruby = "10.0.2.0"
3838
jslt = "0.1.14"
39-
jsonSchemaValidator = "1.5.9"
39+
jsonSchemaValidator = "2.0.0"
4040
kaml = "0.102.0"
4141
kotest = "6.0.4"
4242
kotlinPoet = "2.2.0"

model/src/test/kotlin/JsonSchemaTest.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
package org.ossreviewtoolkit.model
2121

2222
import com.networknt.schema.InputFormat
23-
import com.networknt.schema.JsonSchemaFactory
24-
import com.networknt.schema.SpecVersion
23+
import com.networknt.schema.SchemaRegistry
24+
import com.networknt.schema.SpecificationVersion
2525

2626
import io.kotest.core.spec.style.StringSpec
2727
import io.kotest.inspectors.forAll
@@ -30,6 +30,7 @@ import io.kotest.matchers.should
3030
import io.kotest.matchers.shouldNot
3131

3232
import java.io.File
33+
import java.net.URI
3334

3435
import org.ossreviewtoolkit.model.config.RepositoryConfiguration
3536
import org.ossreviewtoolkit.utils.ort.ORT_LICENSE_CLASSIFICATIONS_FILENAME
@@ -265,7 +266,11 @@ class JsonSchemaTest : StringSpec({
265266
}
266267
})
267268

268-
private val schemaV7 = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7)
269+
private val schemaV7 = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_7) {
270+
builder -> builder.schemaLoader {
271+
schemaLoader -> schemaLoader.fetchRemoteResources()
272+
}
273+
}
269274

270275
private val repositoryConfigurationSchema =
271276
File("../integrations/schemas/repository-configuration-schema.json").toURI()
@@ -275,3 +280,5 @@ private val repositoryConfigurationAnalyzerConfiguration =
275280

276281
private val repositoryConfigurationPackageManagerConfiguration =
277282
File("../integrations/schemas/repository-configurations/package-manager-configuration-schema.json").toURI()
283+
284+
private fun SchemaRegistry.getSchema(uri: URI) = getSchema(uri.toURL().openStream())

utils/test/src/main/kotlin/Matchers.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import com.github.difflib.DiffUtils
2323
import com.github.difflib.UnifiedDiffUtils
2424

2525
import com.networknt.schema.InputFormat as NetworkNtInputFormat
26-
import com.networknt.schema.JsonSchemaFactory
27-
import com.networknt.schema.SpecVersion
26+
import com.networknt.schema.SchemaRegistry
27+
import com.networknt.schema.SpecificationVersion
2828

2929
import io.kotest.assertions.eq.EqMatcher
3030
import io.kotest.matchers.Matcher
@@ -135,7 +135,7 @@ enum class InputFormat(internal val networkNtInputformat: NetworkNtInputFormat)
135135

136136
fun matchJsonSchema(schemaJson: String, inputFormat: InputFormat = InputFormat.JSON): Matcher<String> =
137137
Matcher { actual ->
138-
val schema = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7).getSchema(schemaJson)
138+
val schema = SchemaRegistry.withDefaultDialect(SpecificationVersion.DRAFT_7).getSchema(schemaJson)
139139
val violations = schema.validate(actual, inputFormat.networkNtInputformat)
140140

141141
MatcherResult(

0 commit comments

Comments
 (0)