lua-schema


Overview

lua-schema is a JSON Schema (classical & modern) data validator.

It validates data from a JSON instance or from any equivalent data model, for example CBOR, Message Pack, UBJSON or just plain Lua.

References

The JSON Schema specifications are available on https://json-schema.org/.

The following versions are supported:

Status

lua-schema is in beta stage.

It's developed for Lua 5.1, 5.2, 5.3, 5.4 & 5.5.

The keyword $dynamicRef is not fully supported, especially for extendible schema.

For the semantic content validation (keyword format):

  • date-time, date, time, duration, email, hostname, ipv4, ipv6, uri, uri-reference, iri, iri-reference, uuid, uri-template, json-pointer, relative-json-pointer & regex are implemented
  • idn-email & idn-hostname are not yet implemented

Punycode for format hostname is not yet implemented.

The leap second is not supported (format date-time & time).

lua-schema is monitored by Bowtie, which gives independent reports.

Download

lua-schema source can be downloaded from Framagit.

Installation

With Lua 5.1 & 5.2, lua-schema depends on compat53.

lua-schema depends on LPeg which is heavily used by the semantic content validation (keyword format).

The use of regular expression (keyword pattern & patternProperties) depends on Lrexlib-PCRE2, but it is optional.

lua-schema is available via LuaRocks:

luarocks install lua-schema

or manually, with:

make install

Test

The test suite requires the modules lua-TestAssertion & dkjson.

make test

It run against the official JSON Schema Test Suite.

Copyright © 2025-2026 François Perrad

This library is licensed under the terms of the MIT/X11 license, like Lua itself.