json-schema-validator

The JSON schema validation library that works with https://github.com/Kotlin/kotlinx.serialization

MIT License

Stars
11

Bot releases are visible (Hide)

json-schema-validator - Release 0.0.12 Latest Release

Published by OptimumCode 6 months ago

🚀 Features

  • Add hostname and idn-hostname format validators (PR: #82)

🐛 Fixes

🤔 No bugs at all?

🧰 CI/CD

  • Bump gradle/wrapper-validation-action from 2 to 3 (PR: #94)

Dependencies

  • Bump com.networknt:json-schema-validator from 1.3.3 to 1.4.0 (PR: #89)
  • Bump com.eygraber:uri-kmp from 0.0.17 to 0.0.18 (PR: #90)
  • Bump io.openapiprocessor:json-schema-validator-bom from 2024.1 to 2024.2 (PR: #92)
  • Bump io.gitlab.arturbosch.detekt from 1.23.5 to 1.23.6 (PR: #91)
  • Bump gradle/wrapper-validation-action from 2 to 3 (PR: #94)
  • Bump io.github.gradle-nexus.publish-plugin from 1.3.0 to 2.0.0 (PR: #93)
  • Extract tests for each platform into separate jobs (PR: #96)

https://github.com/OptimumCode/json-schema-validator/compare/0.0.11...0.0.12

json-schema-validator - Release 0.0.11

Published by OptimumCode 7 months ago

🚀 Features

  • Add uuid fromat validator (PR: #78)

🐛 Fixes

  • Fix incorrect URI resolution when root schema $id is not an absolute URI (PR: #88)

Dependencies

  • Bump kotest from 5.8.0 to 5.8.1 (PR: #80)
  • Bump com.fasterxml.jackson:jackson-bom from 2.16.1 to 2.16.2 (PR: #81)
  • Bump com.eygraber:uri-kmp from 0.0.16 to 0.0.17 (PR: #85)
  • Bump okio from 3.8.0 to 3.9.0 (PR: #84)
  • Bump com.fasterxml.jackson:jackson-bom from 2.16.2 to 2.17.0 (PR: #83)
  • Add configuration for devcontainers (PR: #79)

0.0.10..0.0.11

json-schema-validator - Release 0.0.10

Published by OptimumCode 8 months ago

🚀 Features

  • Add support for json-pointer and relative-json-pointer formats (PR: #73)
  • Add ipv4 and ipv6 format validators (PR: #74)

🐛 Fixes

🤔 No bugs at all?

Dependencies

  • Bump org.jetbrains.dokka from 1.9.10 to 1.9.20 (PR: #76)
  • Bump kotlin from 1.9.22 to 1.9.23 (PR: #77)
json-schema-validator - Release 0.0.9

Published by OptimumCode 8 months ago

🚀 Features

  • Add partial support for format keyword (PR: #72)

🐛 Fixes

  • Fix double rounding issues for multipleOf assertion (PR: #71)
  • Add issue templates (PR: #68)
json-schema-validator - Release 0.0.8

Published by OptimumCode 8 months ago

🚀 Features

  • Support vocabulary customization in custom meta-schemes (PR: #66)

🐛 Fixes

  • Rework the way the circled references are determine to avoid false-positive results (PR: #63)
  • Bump serialization from 1.6.2 to 1.6.3 (PR: #64)
  • Bump org.jetbrains.kotlinx.kover from 0.7.5 to 0.7.6 (PR: #65)
  • Bump com.networknt:json-schema-validator from 1.3.2 to 1.3.3 (PR: #67)
json-schema-validator - Release 0.0.7

Published by OptimumCode 8 months ago

🚀 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)
  • 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)
json-schema-validator - Release 0.0.6

Published by OptimumCode 9 months ago

🚀 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)
  • 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)
json-schema-validator - Release 0.0.5

Published by OptimumCode 10 months ago

🚀 Features

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

🐛 Fixes

🤔 No bugs at all?

  • Refactor assertion context (PR: #37)
json-schema-validator - Release 0.0.4

Published by OptimumCode 10 months ago

🚀 Features

No new features today 😢

🐛 Fixes

  • Correct companion object visibility (PR: #34)
json-schema-validator - Release 0.0.3

Published by OptimumCode 10 months ago

🚀 Features

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

🐛 Fixes

🤔 No bugs at all?

🧰 CI/CD

  • Add version update to release workflow (PR: #24)
  • 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)
  • Split items and additionalItems assertions (PR: #28)
json-schema-validator - Release 0.0.2

Published by OptimumCode about 1 year ago

🚀 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?

  • Fix test suites running for ios target (PR: #21)
json-schema-validator - Release 0.0.1

Published by OptimumCode about 1 year ago

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

Badges
Extracted from project README
Licence Supported-drafts FOSSA Status Open in GitHub Codespaces Open in DevPod! draft-04 draft-06 draft-07 draft/2019-09 draft/2020-12 FOSSA Status