Skip to content

About

Validate JSON values against JSON Schema (draft 2020-12)

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

@deckyard/jsonschema

test Documentation release

Validates a json.Value against a JSON Schema draft 2020-12 schema in Jennifer, and reports every failure with a JSON Pointer to the value and to the keyword. Passes every required test in the official JSON-Schema-Test-Suite.

Documentation

Install

jvc add @deckyard/jsonschema

This vendors the deck to vendor/deckyard/jsonschema/. Without jvc, unpack the src/ subtree of a release archive (deckyard-jsonschema-<version>.tar.gz) there.

Usage

import "@deckyard/jsonschema/" as jsonschema;

def s as jsonschema.Schema init jsonschema.compile(json.decode(fs.readString("order.schema.json")));
def r as jsonschema.Result init jsonschema.validate($s, json.decode(fs.readString("order.json")));
if (not $r.valid) {
    io.printf("%s", jsonschema.describe($r));
}

examples/validate.j validates a good and a bad order.

Scope

  • All of draft 2020-12: $ref, $dynamicRef, $anchor, unevaluatedProperties, unevaluatedItems, vocabularies. Draft 7's dependencies is honoured too.
  • No network: references resolve within the schema, to documents registered in a Registry, and to the embedded 2020-12 meta-schemas.
  • format is checked on request for the common formats; see the formats guide.
  • Patterns are RE2, Jennifer's regex dialect, with ECMA-262's \s, ., \cX and \uXXXX translated; lookaround and backreferences are not available.

Requirements

Jennifer 0.25.0 or newer. Pure computation: no network, no capabilities. Not tested on jennifer-tiny.

Development

tools/check-all.sh                   # the full gate, as CI runs it
jennifer test src/jsonschema_test.j  # unit tests and the test suite
tools/gen-meta.sh                    # refresh the embedded meta-schemas

testdata/suite is the vendored JSON-Schema-Test-Suite (MIT); testdata/exclusions.txt lists the cases the deck knowingly fails, and why.

Licence

LGPL-3.0-only, see LICENSE. Copyright (C) 2026 mplx <mplx@jennifer-lang.dev>.

The embedded meta-schemas in src/topics/meta.j are the JSON Schema Specification Authors' work under BSD-3-Clause or AFL-3.0; the notice is in that file.

About

Validate JSON values against JSON Schema (draft 2020-12)

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages