# Cheatsheet
Every export of @deckyard/jsonschema. tools/check-docs.sh checks this page against the code.
jennifer import "@deckyard/jsonschema/" as jsonschema;
# Compiling
Function Returns Does compile(schema)SchemaCompile a schema whose references stay inside it compileWith(schema, reg)SchemaCompile a schema whose references may reach documents in reg assertFormats(s, on)SchemaThe same schema with format asserted (true) or only annotated (false, the default) registry()RegistryAn empty registry register(reg, uri, schema)Registryreg with schema added under the absolute URI uri
compile and compileWith throw an Error of kind jsonschema when the schema is not an object or a boolean, and register when uri is relative.
# Validating
Function Returns Does validate(s, instance)ResultCheck a value, collecting every failure isValid(s, instance)boolCheck a value, stopping at the first failure describe(r)stringOne line per failure: instancePath: message [schemaPath]
Both checks throw an Error of kind jsonschema when evaluation reaches a part of the schema it cannot use: a $ref that resolves to nothing, a reference cycle, a keyword with a value of the wrong type, or a pattern RE2 cannot compile.
# Types
# Schema
Field Meaning root as json.Valuethe schema document base as stringits base URI: its $id, or DEFAULT_BASE registry as Registryevery resource its references can reach formats as boolwhether format is asserted validation as boolwhether the validation vocabulary is in force
# Registry
Field Meaning resources as map of string to json.Valueresource URI to its root schema anchors as map of string to stringuri#name to uri#pointerdynamic as map of string to booluri#name of every $dynamicAnchormeta as boolwhether the 2020-12 meta-schemas are loaded
# Result
Field Meaning valid as boolwhether the value satisfies the schema errors as list of Issuewhy not; empty when valid
# Issue
Field Meaning instancePath as stringJSON Pointer to the failing value schemaPath as stringJSON Pointer to the failing keyword, through every $ref followed keyword as stringthe keyword that failed message as stringwhat is wrong
# Constants
Constant Value Meaning ERROR_KIND"jsonschema"the kind of every Error the deck throws DEFAULT_BASE"jsonschema:/root.json"the base URI of a schema without an absolute $id