Skip to content


Repository files navigation


jinx is a recursive acronym: jinx is not xml-schema

jinx is json-schema!

Clojars CircleCI


Almost all Clojure implementations of json schema validators wrap Java libraries. This is generally a good idea.

However, there are some reasons why a native Clojure implementation can be useful:

  • Java libraries compile jsonschema to object graphs, making them inaccessible to many of the data functions in the Clojure core library.

  • On the front-end, it can be painful to have to convert Clojure data to JavaScript objects simply for the purposes of calling a jsonschema validation such as Ajv.

  • Extensibility: JSON Schema is designed to be extended with additional vocabularies. Clojure has some nice open-for-extension mechanisms.

  • Size: Implementing JSON Schema is not that scary in a language as nice as Clojure. There’s not so much code to read, understand and possibly extend.


This library implements JSON Schema 'draft7' (draft-handrews-json-schema-validation-01).


This is a new project, of alpha status. There may be future incompatible changes ahead.

Most core features are working but there is more work yet to do:

  • Improved Error messages

  • Relative json-pointer

  • Patterns for uri-template and idn-email

This library is tested with the official JSON-Schema-Test-Suite.

JSON Schema provides an official test suite, of which jinx passes all the non-optional tests, and all but two of the optional tests.



(require '[juxt.jinx-alpha-2 :as jinx])

Create a schema

(jinx/schema {"type" "array" "items" {"type" "string"}})

Create a schema (short-hand)

(jinx/clj->jsch ['string])

Validate a document

  (jinx/schema {"type" "object"}))


A schema is a Clojure map (or boolean) that should be augmented with metadata by calling juxt.jinx.schema/schema on the schema data:

(juxt.jinx.schema/schema {"type" "object"})


Validation can take an optional options map.

The :resolvers entry should be a collection of resolvers.

  • :juxt.jinx.resolve/built-in is the built-in resolver which will resolve schemas contained in the library, such as the draft7 meta-schema.

  • :juxt.jinx.resolve/default-resolver is a resolver which takes an argument of a map of URIs (or regexes) to values.

    A value can be a schema (which should be pre-processed with schema metadata by calling juxt.jinx.schema/schema).

    A value may also be a function (called with the URI or, in the case of a regex, the result of the regex match):

    {#"*)" (fn [match] {:type "object"
                                                     :path (second match)})}


When you clone this repository, use the --recursive option to ensure that the official json schema repo is also cloned (as a submodule).

git clone --recursive

Alternative implementations


jinx is not xml-schema (it's json-schema!)







No packages published