import { addJsontron, metaSchema, specVersion, JsontronSchemaError } from "@devlooped/jsontron";
import type {
JsontronEvaluationErrorParams, JsontronItem, JsontronKeywords, JsontronLet, JsontronRule, JsontronSugar,
} from "@devlooped/jsontron";
Names marked type are TypeScript types only, with no run-time value.
Functions and values
Export
Description
addJsontron<T extends Ajv>(ajv: T): T
Adds rules, assert, report and let to ajv and returns it. See Building schemas.
metaSchema: Readonly<Record<string, unknown>>
The Jsontron 0.2 meta-schema, https://www.schemastore.org/jsontron-0.2.json.
specVersion: "0.2"
The version of the Jsontron specification the package implements.
Errors
Export
Description
JsontronSchemaError
Thrown by ajv.compile for a keyword value that does not match the syntax, or a jq expression that does not compile. Extends Error; its name is "JsontronSchemaError".
JsontronEvaluationErrorParams (type)
The params of the Ajv error of an evaluation error: { evaluationError: string }, jq's error text. See Validation results.
Schema types
Types of the keyword values, to type schemas written in TypeScript.
Export
Description
JsontronKeywords (type)
The Jsontron keywords of a schema object: rules?, assert?, report?, let?.
JsontronRule (type)
A rule: context, id?, let?, asserts?, reports?.
JsontronItem (type)
An assert or report item: test, message?, id?, flag?, role?.
JsontronSugar (type)
The value of assert and report: string \| JsontronItem \| (string \| JsontronItem)[].
JsontronLet (type)
The value of let: Record<string, string>, names to jq expressions, in order.