Skip to content

Releases: OptimumCode/json-schema-validator

Release 0.0.7

10 Feb 17:35
db19e49
Compare
Choose a tag to compare

🚀 Features

  • Provide ability to register custom assertion (PR: #53)

🐛 Fixes

🤔 No bugs at all?

🧰 CI/CD

  • Update actions version to work on node 20 (PR: #52)
  • Add Dependabot configuration to the project (PR: #55)
  • Migrate to Gradle dependency submission (PR: #61)
Uncategorized
  • Add benchmark sub-project (PR: #48)
  • Add badges from bowtie report run (PR: #50)
  • Pull latest updates from json schema test suite (PR: #51)
  • Bump org.jlleitschuh.gradle.ktlint from 12.0.3 to 12.1.0 (PR: #60)
  • Bump io.gitlab.arturbosch.detekt from 1.23.4 to 1.23.5 (PR: #58)
  • Bump okio from 3.7.0 to 3.8.0 (PR: #59)
  • Bump com.networknt:json-schema-validator from 1.3.1 to 1.3.2 (PR: #56)
  • Add documentation and example for creating custom assertions (PR: #62)
Also merged but not included in notes

Release 0.0.6

01 Feb 18:49
8f277d1
Compare
Choose a tag to compare

🚀 Features

  • Create JsonSchemaLoader interface to support external schema loading (PR: #42)

🐛 Fixes

  • Move references validation to the latter stage (PR: #45)

🧰 CI/CD

  • Update actions versions (PR: #41)
  • Add upload coverage results to codecov (PR: #44)
Uncategorized
  • Update dependencies to support Kotlin 1.9 (PR: #39)
  • Update uri-kmp to 0.0.16 and binary-compatibility-validator to 0.14.0 (PR: #43)
Also merged but not included in notes

Release 0.0.5

01 Jan 14:31
30f94f8
Compare
Choose a tag to compare

🚀 Features

  • Add support for Draft 2020-12 (PR: #36)

🐛 Fixes

🤔 No bugs at all?

Uncategorized
  • Refactor assertion context (PR: #37)
Also merged but not included in notes

Release 0.0.4

30 Dec 10:17
b1d27b2
Compare
Choose a tag to compare

🚀 Features

No new features today 😢

🐛 Fixes

  • Correct companion object visibility (PR: #34)
Uncategorized
Also merged but not included in notes

Release 0.0.3

30 Dec 08:12
91fa99d
Compare
Choose a tag to compare

🚀 Features

  • Add support for Draft 2019-09 (PR: #30)

🐛 Fixes

🤔 No bugs at all?

🧰 CI/CD

  • Add version update to release workflow (PR: #24)
Uncategorized
  • Each assertion should be loaded independently instead of grouping in one factory (PR: #22)
  • Update schema test suit reference (PR: #32)
  • Add draft 2019-09 to readme (PR: #33)
Also merged but not included in notes
  • Split items and additionalItems assertions (PR: #28)

Release 0.0.2

28 Jul 12:12
e136ff0
Compare
Choose a tag to compare

🚀 Features

  • Support $schema property to identify schema draft to use (PR: #16)
  • The $id should be treated as a URI (PR: #17)
  • Make library comply to official JSON schema repository test-suites (PR: #19)

🐛 Fixes

🤔 No bugs at all?

Uncategorized
Also merged but not included in notes
  • Fix test suites running for ios target (PR: #21)

Release 0.0.1

23 Jul 09:52
73fa548
Compare
Choose a tag to compare

This is the first release of the multiplatform JSON-schema-validator library.

🚀 Features

  • Support for Draft 7
    • All assertion keywords are supported
    • Most of the schema keywords are supported
      • $id works only for the root schema
      • $schema value is not used
      • $ref works only for relative references (like #/definitions/negativeInteger)

Usage

Add library to your dependencies

implementation("io.github.optimumcode:json-schema-validator:0.0.1")

Create a schema and validate the JSON element you need

import io.github.optimumcode.json.schema.JsonSchema
import io.github.optimumcode.json.schema.ValidationError
import kotlinx.serialization.json.JsonElement

val key = "\$" // to use $ in multiline string
val schema = JsonSchema.fromDefinition(
  """
  {
    "${key}schema": "http://json-schema.org/draft-07/schema#",
    "definitions": {
      "positiveInteger": {
        "type": "integer",
        "minimum": 0
      }
    },
    "properties": {
      "size": { "${key}ref": "#/definitions/positiveInteger" }
    }
  }
  """.trimIndent(),
)
val errors = mutableListOf<ValidationError>()
val elementToValidate: JsonElement = loadJsonToValidate()

val valid = schema.validate(elementToValidate, errors::add)

Future

This library is in the early stage of development so more changes and features are on the way.
Some of them you can find in the README and opened issues.

If you have any questions/suggestions/problems, please, create an issue on GitHub and I will try to help you