The project

Jsontron is one vocabulary with several implementations that must not drift apart. The repository is organized so that they cannot: the behaviour is written down once, tested once, and every implementation runs the same tests.

How the parts fit

flowchart LR
  S["Specification<br>spec/jsontron.md"] --> M["Meta-schema<br>schemas/jsontron-0.2.json"]
  S --> T["Conformance suite<br>tests/*.json"]
  M --> N[".NET<br>JsonSchema.Net"]
  M --> J["TypeScript<br>Ajv"]
  M --> P["Python<br>jsonschema"]
  T --> N
  T --> J
  T --> P
  Q["jqlite<br>(one jq engine,<br>native in each language)"] --> N
  Q --> J
  Q --> P
Part Where What it is
The specification spec/jsontron.md The keywords, how a rule set is merged and evaluated, messages, reporting, build-time checks. It is normative.
The meta-schema schemas/jsontron-0.2.json The syntax of the keywords, published on SchemaStore as https://www.schemastore.org/jsontron-0.2.json. Its version is the version of the specification.
The conformance suite tests Schemas, documents, and the failures each one must give. Every implementation runs every file.
The implementations dotnet, js, python Real keywords of the main JSON Schema library of each language, not a pass over its annotations, so that they take part in if, not, anyOf, oneOf and $ref.
The jq engine jqlite A portable profile of jq 1.8 with the same semantics in every language, no native or WebAssembly dependency, and synchronous evaluation.

A change of behaviour goes through them in that order: the specification and a case in the suite first, then every implementation in the same change. An implementation never special-cases a case of the suite.

Two ways to evaluate

The specification gives a reference lowering: a rule set compiles to one jq program whose input is {root, node} and whose output is the array of failure texts. The TypeScript and Python implementations run that program; the .NET implementation evaluates expression by expression, with jqlite variables. The suite keeps the two equal.

Releases

One GitHub release publishes the three packages, with the same version: Jsontron on NuGet, @devlooped/jsontron on npm and jsontron on PyPI. Each package states the version of the specification it implements, which moves independently of the package version. The changelog lists the changes of each release.

Adding a language

  1. Pick the most used JSON Schema library of the language that lets a custom keyword see its sibling keywords, run a step when the schema is compiled, and read the root instance.
  2. Use jqlite for the language when there is one, or a jq engine that follows jq 1.8.
  3. Implement the merge of the keywords (ยง2 of the specification), then either the lowering or direct evaluation, and a runner over tests/*.json as the suite describes.

Go and Rust wait on their main libraries (santhosh-tekuri/jsonschema and the jsonschema crate), which do not give a custom keyword the root instance. Java is planned on networknt's json-schema-validator.

Contributing

The source, the issues and the discussions are on GitHub. The repository's AGENTS.md says where each kind of change goes.

Jsontron is under the MIT license, and its use is subject to the Open Source Maintenance Fee EULA.