
json_schema.pl -- JSON Schema reader and validator
This module provides a JSON Schema reader and validator. This module is based on the 2020-12 draft of the specification.
The API consists of two primitives and a simple high level predicate (json_validate/3):
- json_compile_schema/3 translates a file or parsed JSON schema data into a Prolog term that represents the schema in a way that is more suitable for checking a JSON document.
- json_check/3 validates a document against the compiled schema.
Status
The implementation is validated against https://github.com/json-schema-org/JSON-Schema-Test-Suite.git. It fails 4 out of 1,261 tests. Issues:
$dynamicReffails 3 tests, probably mixing up physical context and resolution context that defines the dynamic scopes.- There is no support for non-default vocabulary selection.
The current implementation is the result of an incremental process. It should be refactored to make it a cleaner translation of the specification.