| Did you know ... | Search Documentation: |
| 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):
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:
$dynamicRef fails 3 tests, probably mixing up physical context
and resolution context that defines the dynamic scopes.The current implementation is the result of an incremental process. It should be refactored to make it a cleaner translation of the specification.
json_validate(+SchemaFile, +DataDict, +Options) is det
json_compile_schema(+Input, -Type, +Options) is det
If Input is a file name, the loaded and compiled schema is cached.
Reusing the cache validates the modification file of the schema file
and reloads it if the file's time stamp has changed. Note that
true and false are valid schemas and cannot be used as file
names.
json_check(+Spec, ?JSON, +Options) is semidetThis predicate is often used through validate_json_dict/3, which mantains a cached mapping from the JSON Schema to Spec.