The json-schema Reference Manual

This is the json-schema Reference Manual, version 2.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:32:07 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 json-schema

JSON schema validation

Author

Matt Novenstern <>

Home Page

https://fisxoj.github.io/json-schema/

License

LLGPL

Long Description

.. image:: https://travis-ci.org/fisxoj/json-schema.svg?branch=master
:target: https://travis-ci.org/fisxoj/json-schema
:alt: Travis CI status badge
.. image:: https://coveralls.io/repos/github/fisxoj/json-schema/badge.svg?branch=master
:target: https://coveralls.io/github/fisxoj/json-schema?branch=master
:alt: Coveralls status badge
.. image:: https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg
:alt: Contributor Covenant
:target: CODE_OF_CONDUCT.md

:Source: ‘https://github.com/fisxoj/json-schema <https://github.com/fisxoj/json-schema>‘_
:Docs: ‘https://fisxoj.github.io/json-schema/ <https://fisxoj.github.io/json-schema/>‘_

json-schema is a validator for drafts 4, 6, 7, and 2019-09 of the ‘JSON Schema <https://json-schema.org/>‘_ standard. It is (mostly) compliant with the ‘common test suite <https://github.com/json-schema-org/JSON-Schema-Test-Suite>‘_. The exceptions are

**Draft 2019-09:**

- “unevaluatedItems“ and “unevaluatedProperties“ are unimplemented

**Drafts 4, 6, 7:**

- “$ref“ does not override any sibling keywords

——-
Example
——-

The main entry point to the library is :function:‘json-schema:validate‘, which takes a schema to validate against, the data to validate against it and a draft version to use for interpreting the schema. The default version is currently draft7.

**Validating a simple type**

Passing
::

(json-schema:validate 3 :schema (json-schema.parse:parse "{\"type\":\"integer\"}"))
;; => T
;; NIL

Failing (note the error messages in the second argument)
::

(json-schema:validate 13 :schema (json-schema.parse:parse "{\"type\":\"integer\",\"maximum\":10}"))
;; => NIL
;; ("13 must be less than or equal to 10")

**Validating an object**
::

(setf schema (json-schema.parse:parse
"{\"properties\":{\"foo\\nbar\":{\"type\":\"number\"},\"foo\\\"bar\":{\"type\":\"number\"},\"foo\\\\bar\":{\"type\":\"number\"},\"foo\\rbar\":{\"type\":\"number\"},\"foo\\tbar\":{\"type\":\"number\"},\"foo\\fbar\":{\"type\":\"number\"}}}"))

Passing
::

(json-schema:validate
(json-schema.parse:parse
"{\"foo\\nbar\":1,\"foo\\\"bar\":1,\"foo\\\\bar\":1,\"foo\\rbar\":1,\"foo\\tbar\":1,\"foo\\fbar\":1}") :schema schema)
;; => T
;; NIL

Failing
::

(json-schema:validate
(json-schema.parse:parse
"{\"foo\\nbar\":\"1\",\"foo\\\"bar\":\"1\",\"foo\\\\bar\":\"1\",\"foo\\rbar\":\"1\",\"foo\\tbar\":\"1\",\"foo\\fbar\":\"1\"}") :schema schema)
;; => NIL
;; ("got errors validating properties
;;
;; Additionally:
;; - Value 1 is not of type \"number\".
;; - Value 1 is not of type \"number\".
;; - Value 1 is not of type \"number\".
;; - Value 1 is not of type \"number\".
;; - Value 1 is not of type \"number\".
;; - Value 1 is not of type \"number\".
;; ")

**Validating a document with a referenced schema**

If your data contains a top-level “$schema“ key, you don’t need to pass a schema along. It will be fetched and validated against automatically. This works with, for example, the ‘draft2019-09 meta-schema <https://json-schema.org/draft/2019-09/schema>‘_.

———–
Usage Notes
———–

~~~~~~~~
Contexts
~~~~~~~~

A context is a reusable set of state that contains all of the fetched network resources (if your schema references external resources) and resolved ids. By storing that all, you can reuse the validation context multiple times without fetching/resolving everything again.
::
(ql:quickload ’(trivial-benchmark json-schema))

(defvar *schema* (json-schema.parse:parse #P"~/Downloads/schema"))

;; schema is the json-schema meta schema document from:
;; https://json-schema.org/specification-links.html#draft-2019-09-formerly-known-as-draft-8

(defvar *context*
(json-schema:make-context
*schema*
:draft2019-09))

;;; Cached

(let ((data (json-schema.parse:parse "{\"type\": \"string\"}")))
(trivial-benchmark:with-timing (1000)
(json-schema:validate data
:context *context*)))

;; - SAMPLES TOTAL MINIMUM MAXIMUM MEDIAN AVERAGE DEVIATION
;; REAL-TIME 1000 0.826 0 0.022 0.001 0.000826 0.000797
;; RUN-TIME 1000 0.826 0 0.022 0.001 0.000826 0.0008
;; USER-RUN-TIME 1000 0.781011 0 0.020644 0.000745 0.000781 0.000665
;; SYSTEM-RUN-TIME 1000 0.049933 0 0.000986 0 0.00005 0.000184
;; PAGE-FAULTS 1000 0 0 0 0 0 0.0
;; GC-RUN-TIME 1000 0.02 0 0.02 0 0.00002 0.000632
;; BYTES-CONSED 1000 213753664 195344 228976 228032 213753.66 16221.591
;; EVAL-CALLS 1000 0 0 0 0 0 0.0

;;; Uncached

(let ((data (json-schema.parse:parse "{\"type\": \"string\"}")))
(trivial-benchmark:with-timing (1000)
(json-schema:validate data
:schema *schema*
:schema-version :draft2019-09)))

;; - SAMPLES TOTAL MINIMUM MAXIMUM MEDIAN AVERAGE DEVIATION
;; REAL-TIME 1000 203.185 0.148 1.471 0.185 0.203185 0.112807
;; RUN-TIME 1000 9.25 0.006 0.04 0.009 0.00925 0.002294
;; USER-RUN-TIME 1000 8.145081 0.003368 0.039067 0.008105 0.008145 0.002317
;; SYSTEM-RUN-TIME 1000 1.107377 0 0.004927 0.000994 0.001107 0.000967
;; PAGE-FAULTS 1000 0 0 0 0 0 0.0
;; GC-RUN-TIME 1000 0.08 0 0.03 0 0.00008 0.001464
;; BYTES-CONSED 1000 719780512 707728 751424 718160 719780.5 11026.181
;; EVAL-CALLS 1000 0 0 0 0 0 0.0

So, for this trivial example, the cached version is around a 245x speedup! Note, though, that json-schema evaluates these things lazily, so not every reference is necessarily resolved when the context is created. They are mutable, though, and will build up state as they go.

Thank you to ‘Raymond Wiker <https://github.com/rwiker>‘_ for contributing the initial implementation.

~~~~~~~~~~~~~
Decoding JSON
~~~~~~~~~~~~~

json-schema operates mostly on :class:‘cl:hash-table‘ objects. It requires them to have the “:test“ argument set to :function:‘cl:equal‘, so that they work with string keys. Further, it expects “:true“ and “:false“ as the boolean values and “:null“ as the decoded Javascript “null“. Javascrpit arrays should be rendered as lists. This behavior is provided behind the scenes by ‘st-json <https://marijnhaverbeke.nl/st-json/>‘_. The :function:‘json-schema.parse:parse‘ function provides this functionality over strings, streams, and pathnames for you.

~~~~~~~~~~~~~~
Network access
~~~~~~~~~~~~~~

JSON Schema allows schemas to reference other documents over the network. This library will fetch them automatically, by default. If you don’t want this to be allowed, you should set :variable:‘json-schema.reference:*resolve-remote-references*‘ to “nil“. If a schema references a remote one, it will raise a :class:‘json-schema.reference:fetching-not-allowed-error‘ instead of fetching it when fetching references is disallowed.

Version

2.0.0

Dependencies
  • alexandria (system).
  • arrows (system).
  • cl-ppcre (system).
  • dexador (system).
  • function-cache (system).
  • local-time (system).
  • local-time-duration (system).
  • quri (system).
  • sanity-clause (system).
  • st-json (system).
  • str (system).
  • trivial-types (system).
Source

json-schema.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 json-schema/json-schema.asd

Source

json-schema.asd.

Parent Component

json-schema (system).

ASDF Systems

json-schema.


3.1.2 json-schema/utils.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.utils.

Public Interface

3.1.3 json-schema/parse.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.parse.

Public Interface

parse (function).


3.1.4 json-schema/types.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.types.

Public Interface
Internals

3.1.5 json-schema/reference.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.reference.

Public Interface
Internals

3.1.6 json-schema/formats.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.formats.

Public Interface
Internals

3.1.7 json-schema/validators.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.validators.

Public Interface
Internals

3.1.8 json-schema/json-schema.lisp

Source

json-schema.asd.

Parent Component

json-schema (system).

Packages

json-schema.

Public Interface

4 Packages

Packages are listed by definition order.


4.1 json-schema

Source

json-schema.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface

4.2 json-schema.utils

Source

utils.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface

4.3 json-schema.types

Source

types.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

4.4 json-schema.formats

Source

formats.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

4.5 json-schema.validators

Source

validators.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

4.6 json-schema.parse

Source

parse.lisp.

Use List
  • alexandria.
  • arrows.
  • common-lisp.
Public Interface

parse (function).


4.7 json-schema.reference

Source

reference.lisp.

Use List
  • alexandria.
  • arrows.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *http-connect-timeout*

Number of seconds before a :class:‘remote-reference-error‘ will be signaled while trying to connect to a remote schema.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *http-read-timeout*

Number of seconds before a :class:‘remote-reference-error‘ will be signaled while trying to read a remote schema.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *resolve-remote-references*

Whether to download other schemas for references. Will error if another uri is referenced in a schema and this var is set to “nil“.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *schema-version*
Package

json-schema.

Source

json-schema.lisp.


5.1.2 Macros

Macro: with-context ((context) &body body)
Package

json-schema.reference.

Source

reference.lisp.

Macro: with-pushed-id ((id) &body body)
Package

json-schema.reference.

Source

reference.lisp.

Macro: with-resolved-ref ((ref resolved-schema &optional id-fun) &body body)
Package

json-schema.reference.

Source

reference.lisp.


5.1.3 Ordinary functions

Reader: context-root-schema (instance)
Writer: (setf context-root-schema) (instance)
Package

json-schema.reference.

Source

reference.lisp.

Target Slot

root-schema.

Reader: context-schema-version (instance)
Writer: (setf context-schema-version) (instance)
Package

json-schema.reference.

Source

reference.lisp.

Target Slot

schema-version.

Function: draft2019-09 (value type)
Package

json-schema.types.

Source

types.lisp.

Function: draft2019-09 (value type)
Package

json-schema.formats.

Source

formats.lisp.

Function: draft3 (value type)
Package

json-schema.types.

Source

types.lisp.

Function: draft3 (value type)
Package

json-schema.formats.

Source

formats.lisp.

Function: draft4 (value type)
Package

json-schema.types.

Source

types.lisp.

Function: draft4 (value type)
Package

json-schema.formats.

Source

formats.lisp.

Function: draft6 (value type)
Package

json-schema.types.

Source

types.lisp.

Function: draft6 (value type)
Package

json-schema.formats.

Source

formats.lisp.

Function: draft7 (value type)
Package

json-schema.types.

Source

types.lisp.

Function: draft7 (value type)
Package

json-schema.formats.

Source

formats.lisp.

Function: empty-object-p (object)
Package

json-schema.utils.

Source

utils.lisp.

Function: fetch-schema (uri)

Fetches a remote document or raises an error depending on the value of :variable:‘*resolve-remote-references*‘.

Package

json-schema.reference.

Source

reference.lisp.

Function: get-id-fun-for-schema-version (schema-version)

Selects an id function that’s appropriate for each schema draft.

Package

json-schema.reference.

Source

reference.lisp.

Function: json-equal-p (thing1 thing2)

A generic comparison function for comparing anything that might be a json value.

Package

json-schema.utils.

Source

utils.lisp.

Function: json-pretty-printer (stream json-object at colon)
Package

json-schema.utils.

Source

utils.lisp.

Function: make-context (schema schema-version)

Given a root schema document :param:‘schema‘ and a json schema version :param:‘schema-version‘, create a reusable context object that will cache all schema data including remote references that get fetched.

Package

json-schema.reference.

Source

reference.lisp.

Function: make-empty-object ()
Package

json-schema.utils.

Source

utils.lisp.

Function: object-equal-p (object1 object2)
Package

json-schema.utils.

Source

utils.lisp.

Function: object-get (key object &optional default)
Package

json-schema.utils.

Source

utils.lisp.

Function: object-keys (object)
Package

json-schema.utils.

Source

utils.lisp.

Function: parse (input)
Package

json-schema.parse.

Source

parse.lisp.

Function: relative-reference-p (reference)
Package

json-schema.reference.

Source

reference.lisp.

Function: resolve (ref)

Resolves a reference schema object to the referred-to schema.

Package

json-schema.reference.

Source

reference.lisp.

Function: validate (data &key schema-version pretty-errors-p schema context)

The primary validation function for json-schema. Takes data: which can be a simple value or an object as a hash table, and then optionally accepts a schema (if the data doesn’t contain a top-level “$schema“ key), schema version and pretty-errors-p deterimines whether the second return value is exception objects or strings of the rendered errors (strings by default).

The third return value is a :class:‘json-schema.reference::context‘, which contains all of the state stored in processing a schema including caching network resources and all of the resolved ids.

Package

json-schema.

Source

json-schema.lisp.

Function: validate (schema data &optional schema-version ignore-id)
Package

json-schema.validators.

Source

validators.lisp.


5.1.4 Standalone methods

Method: print-object ((object reference) stream)
Source

reference.lisp.


5.1.5 Conditions

Condition: fetching-not-allowed-error
Package

json-schema.reference.

Source

reference.lisp.

Direct superclasses

reference-error.

Direct slots
Slot: remote-uri
Initargs

:uri

Condition: nested-reference-error
Package

json-schema.reference.

Source

reference.lisp.

Direct superclasses

reference-error.

Condition: reference-error
Package

json-schema.reference.

Source

reference.lisp.

Direct superclasses

error.

Direct subclasses
Direct slots
Slot: message
Initargs

:message

Condition: remote-reference-error
Package

json-schema.reference.

Source

reference.lisp.

Direct superclasses

reference-error.

Direct slots
Slot: remote-uri
Initargs

:uri

Condition: validation-failed-error
Package

json-schema.validators.

Source

validators.lisp.

Direct superclasses

error.

Direct slots
Slot: error-message
Initargs

:error-message

Slot: property-name
Initform

(quote nil)

Initargs

:property-name

Slot: sub-errors
Initform

(quote nil)

Initargs

:sub-errors


5.1.6 Types

Type: json-array ()
Package

json-schema.utils.

Source

utils.lisp.

Type: json-boolean ()
Package

json-schema.utils.

Source

utils.lisp.

Type: json-null ()
Package

json-schema.utils.

Source

utils.lisp.

Type: object ()
Package

json-schema.utils.

Source

utils.lisp.

Type: schema ()
Package

json-schema.utils.

Source

utils.lisp.

Type: schema-version ()
Package

json-schema.utils.

Source

utils.lisp.


5.2 Internals


5.2.1 Constants

Constant: +hostname-regex+
Package

json-schema.formats.

Source

formats.lisp.

Constant: +unreserved-uri-characters+
Package

json-schema.formats.

Source

formats.lisp.


5.2.2 Special variables

Special Variable: *context*

The lookup context for references.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *current-lookup-depth*

Dynamic variable for tracking reference nesting depth.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *id-fun*

A default function for getting ids from schemas. Should return (values id found-p) like gethash.

Package

json-schema.reference.

Source

reference.lisp.

Special Variable: *schema-version*
Package

json-schema.validators.

Source

validators.lisp.

Special Variable: +max-lookup-depth+

Maximum number of nested references to allow before throwing a :class:‘nested-reference-error‘.

Package

json-schema.reference.

Source

reference.lisp.


5.2.3 Macros

Macro: def-checker (name &rest types-plist)
Package

json-schema.types.

Source

types.lisp.

Macro: def-checker (name &rest types-plist)
Package

json-schema.formats.

Source

formats.lisp.

Macro: def-validator (name &rest keys-plist)
Package

json-schema.validators.

Source

validators.lisp.

Macro: defvfun (name validation-field &body body)
Package

json-schema.validators.

Source

validators.lisp.

Macro: with-lookup-depth-tracking (&body body)
Package

json-schema.reference.

Source

reference.lisp.

Macro: with-pushed-context ((schema) &body body)
Package

json-schema.reference.

Source

reference.lisp.


5.2.4 Ordinary functions

Function: $ref (schema reference data)
Package

json-schema.validators.

Source

validators.lisp.

Function: %make-context (&key root-schema schema-version uri-stack references named-references)
Package

json-schema.reference.

Source

reference.lisp.

Function: absolute-uri (reference)

Return an absolute URI for the reference in the current context.

Package

json-schema.reference.

Source

reference.lisp.

Function: additional-items (schema additional-items data)
Package

json-schema.validators.

Source

validators.lisp.

Function: additional-properties (schema value data)
Package

json-schema.validators.

Source

validators.lisp.

Function: all-of (schema sub-schemas data)
Package

json-schema.validators.

Source

validators.lisp.

Function: any-of (schema sub-schemas data)
Package

json-schema.validators.

Source

validators.lisp.

Function: any-p (value)
Package

json-schema.types.

Source

types.lisp.

Function: array-p (value)

Arrays are valid, but not strings.

Package

json-schema.types.

Source

types.lisp.

Function: boolean-p (value)
Package

json-schema.types.

Source

types.lisp.

Function: check-dependencies (property-name dependencies data &key allow-arrays allow-objects)
Package

json-schema.validators.

Source

validators.lisp.

Function: collect-subschemas (schema &key id-fun current-uri properties-p)

Collect all named subschemas into an alist of (name . schema-object).

Package

json-schema.reference.

Source

reference.lisp.

Function: const (schema const data)
Package

json-schema.validators.

Source

validators.lisp.

Function: contains (schema contains data)
Package

json-schema.validators.

Source

validators.lisp.

Reader: context-named-references (instance)
Writer: (setf context-named-references) (instance)
Package

json-schema.reference.

Source

reference.lisp.

Target Slot

named-references.

Function: context-p (object)
Package

json-schema.reference.

Source

reference.lisp.

Reader: context-references (instance)
Writer: (setf context-references) (instance)
Package

json-schema.reference.

Source

reference.lisp.

Target Slot

references.

Reader: context-uri-stack (instance)
Writer: (setf context-uri-stack) (instance)
Package

json-schema.reference.

Source

reference.lisp.

Target Slot

uri-stack.

Function: copy-context (instance)
Package

json-schema.reference.

Source

reference.lisp.

Function: date-time-p (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: datep (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: default-id-fun (schema)
Package

json-schema.reference.

Source

reference.lisp.

Function: dependencies (schema dependencies data)
Package

json-schema.validators.

Source

validators.lisp.

Function: dependent-required (schema dependencies data)
Package

json-schema.validators.

Source

validators.lisp.

Function: dependent-schemas (schema schemas data)
Package

json-schema.validators.

Source

validators.lisp.

Function: description (schema description data)
Package

json-schema.validators.

Source

validators.lisp.

Function: draft2019-09 (schema field value data)
Package

json-schema.validators.

Source

validators.lisp.

Function: draft2019-09-id-fun (schema)

An id extraction function that also pays attention to $anchor properties which provide only location-independent references.

Package

json-schema.reference.

Source

reference.lisp.

Function: draft3-timep (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: draft4 (schema field value data)
Package

json-schema.validators.

Source

validators.lisp.

Function: draft4-id-fun (schema)

Like the default, but id doesn’t have a $ prefix.

Package

json-schema.reference.

Source

reference.lisp.

Function: draft6 (schema field value data)
Package

json-schema.validators.

Source

validators.lisp.

Function: draft7 (schema field value data)
Package

json-schema.validators.

Source

validators.lisp.

Function: durationp (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: emailp (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: enum (schema members data)
Package

json-schema.validators.

Source

validators.lisp.

Function: escape (string)
Package

json-schema.reference.

Source

reference.lisp.

Function: exclusive-maximum (schema maximum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: exclusive-minimum (schema minimum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: fetch-reference (uri)

Fetches a schema and adds it to the current context as a side effect.

Package

json-schema.reference.

Source

reference.lisp.

Function: format-validator (schema type data)
Package

json-schema.validators.

Source

validators.lisp.

Function: get-current-schema ()
Package

json-schema.reference.

Source

reference.lisp.

Function: get-current-uri ()
Package

json-schema.reference.

Source

reference.lisp.

Function: get-ref (spec)
Package

json-schema.reference.

Source

reference.lisp.

Function: hostnamep (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: if-validator (schema condition-schema data)
Package

json-schema.validators.

Source

validators.lisp.

Function: integer-p (value)

JSON Schema considers anything without a fractional part an integer, ie. 1.0d0 is an integer. 🤷

Package

json-schema.types.

Source

types.lisp.

Function: ip-v4-address-p (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: ip-v6-address-p (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: items (schema items data)
Package

json-schema.validators.

Source

validators.lisp.

Function: json-pointer-p (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: lookup (reference)

Look up a schema by reference in the “*context*“. Returns “(values schema new-context-p)“. “new-context-p“ indicates that this schema is a new document that should be pushed to the context stack when visited.

Package

json-schema.reference.

Source

reference.lisp.

Function: make-reference (reference-string)
Package

json-schema.reference.

Source

reference.lisp.

Function: make-relative-path-list (relative-path-string)
Package

json-schema.reference.

Source

reference.lisp.

Function: make-uri-without-fragment (uri)
Package

json-schema.reference.

Source

reference.lisp.

Function: max-items (schema length data)
Package

json-schema.validators.

Source

validators.lisp.

Function: max-length (schema length data)
Package

json-schema.validators.

Source

validators.lisp.

Function: max-properties (schema count data)
Package

json-schema.validators.

Source

validators.lisp.

Function: maximum (schema maximum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: maximum-draft4 (schema maximum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: min-items (schema length data)
Package

json-schema.validators.

Source

validators.lisp.

Function: min-length (schema length data)
Package

json-schema.validators.

Source

validators.lisp.

Function: min-properties (schema count data)
Package

json-schema.validators.

Source

validators.lisp.

Function: minimum (schema minimum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: minimum-draft4 (schema minimum data)
Package

json-schema.validators.

Source

validators.lisp.

Function: multiple-of (schema divisor data)
Package

json-schema.validators.

Source

validators.lisp.

Function: noop (schema property data)

This exists to say we have taken care of a property, but we should do nothing with it. Likely because this property is actually handled by other things. “else“ and “then“ are handled by :function:‘if-validator‘, &c.

Package

json-schema.validators.

Source

validators.lisp.

Function: not-validator (schema sub-schema data)
Package

json-schema.validators.

Source

validators.lisp.

Function: null-p (value)
Package

json-schema.types.

Source

types.lisp.

Function: object-p (value)
Package

json-schema.types.

Source

types.lisp.

Function: one-of (schema sub-schemas data)
Package

json-schema.validators.

Source

validators.lisp.

Function: pattern (schema pattern data)
Package

json-schema.validators.

Source

validators.lisp.

Function: pattern-properties (schema patterns data)
Package

json-schema.validators.

Source

validators.lisp.

Function: pop-context ()
Package

json-schema.reference.

Source

reference.lisp.

Function: populate-named-references-for-schema (schema &key id-fun uri)

Takes an alist of (uri . schema) and populates the appropriate hash tables in the named references slot of the context. Takes the output from collect subschemas, which may return named references for many uri’s, since documents are allowed to insist they have whatever uri they want whenever they want.

Package

json-schema.reference.

Source

reference.lisp.

Function: properties (schema properties data)
Package

json-schema.validators.

Source

validators.lisp.

Function: property-names (schema names-schema data)
Package

json-schema.validators.

Source

validators.lisp.

Function: push-context (schema &optional id-fun)
Package

json-schema.reference.

Source

reference.lisp.

Function: ref-p (spec)

A spec is a reference if it has only one key which is “$ref“.

Package

json-schema.reference.

Source

reference.lisp.

Function: reference-eq (reference1 reference2)
Package

json-schema.reference.

Source

reference.lisp.

Function: regexp (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: required (schema required-fields data)
Package

json-schema.validators.

Source

validators.lisp.

Function: timep (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: type-validator (schema type data)
Package

json-schema.validators.

Source

validators.lisp.

Function: unescape (string)

Unescape a string to replace ~0 and ~1 with ~ and /.

Package

json-schema.reference.

Source

reference.lisp.

Function: unevaluated-properties (schema unevaluated-properties data)
Package

json-schema.validators.

Source

validators.lisp.

Function: unique-items (schema unique data)
Package

json-schema.validators.

Source

validators.lisp.

Function: uri (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: uri-reference (value)
Package

json-schema.formats.

Source

formats.lisp.

Function: validate-type (schema type data)

This is a tool for checking type validation, but isn’t a validator itself. It’s used by many of the validator functions to decide wether they can have an opinion on the data being validated, but is also used by :function:‘type-validator‘.

Package

json-schema.validators.

Source

validators.lisp.


5.2.5 Generic functions

Generic Reader: relative-path-of (object)
Package

json-schema.reference.

Methods
Reader Method: relative-path-of ((reference reference))

automatically generated reader method

Source

reference.lisp.

Target Slot

relative-path.

Generic Writer: (setf relative-path-of) (object)
Package

json-schema.reference.

Methods
Writer Method: (setf relative-path-of) ((reference reference))

automatically generated writer method

Source

reference.lisp.

Target Slot

relative-path.

Generic Reader: uri-of (object)
Package

json-schema.reference.

Methods
Reader Method: uri-of ((reference reference))

automatically generated reader method

Source

reference.lisp.

Target Slot

uri.

Generic Writer: (setf uri-of) (object)
Package

json-schema.reference.

Methods
Writer Method: (setf uri-of) ((reference reference))

automatically generated writer method

Source

reference.lisp.

Target Slot

uri.


5.2.6 Conditions

Condition: no-validator-condition
Package

json-schema.validators.

Source

validators.lisp.

Direct superclasses

condition.

Direct slots
Slot: field-name
Initargs

:field-name


5.2.7 Structures

Structure: context

A container for all state related to resolving references, namely: a stack of context urls

Package

json-schema.reference.

Source

reference.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: root-schema
Type

json-schema.utils:schema

Readers

context-root-schema.

Writers

(setf context-root-schema).

Slot: schema-version
Type

json-schema.utils:schema-version

Readers

context-schema-version.

Writers

(setf context-schema-version).

Slot: uri-stack
Type

(trivial-types:proper-list string)

Readers

context-uri-stack.

Writers

(setf context-uri-stack).

Slot: references
Type

hash-table

Initform

(make-hash-table :test (quote equal))

Readers

context-references.

Writers

(setf context-references).

Slot: named-references
Type

hash-table

Initform

(make-hash-table :test (quote equal))

Readers

context-named-references.

Writers

(setf context-named-references).


5.2.8 Classes

Class: reference
Package

json-schema.reference.

Source

reference.lisp.

Direct methods
Direct slots
Slot: relative-path
Type

(or string (trivial-types:proper-list string))

Initargs

:relative-path

Readers

relative-path-of.

Writers

(setf relative-path-of).

Slot: uri
Type

string

Initargs

:uri

Readers

uri-of.

Writers

(setf uri-of).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   $   %   (  
A   B   C   D   E   F   G   H   I   J   L   M   N   O   P   R   T   U   V   W  
Index Entry  Section

$
$ref: Private ordinary functions

%
%make-context: Private ordinary functions

(
(setf context-named-references): Private ordinary functions
(setf context-references): Private ordinary functions
(setf context-root-schema): Public ordinary functions
(setf context-schema-version): Public ordinary functions
(setf context-uri-stack): Private ordinary functions
(setf relative-path-of): Private generic functions
(setf relative-path-of): Private generic functions
(setf uri-of): Private generic functions
(setf uri-of): Private generic functions

A
absolute-uri: Private ordinary functions
additional-items: Private ordinary functions
additional-properties: Private ordinary functions
all-of: Private ordinary functions
any-of: Private ordinary functions
any-p: Private ordinary functions
array-p: Private ordinary functions

B
boolean-p: Private ordinary functions

C
check-dependencies: Private ordinary functions
collect-subschemas: Private ordinary functions
const: Private ordinary functions
contains: Private ordinary functions
context-named-references: Private ordinary functions
context-p: Private ordinary functions
context-references: Private ordinary functions
context-root-schema: Public ordinary functions
context-schema-version: Public ordinary functions
context-uri-stack: Private ordinary functions
copy-context: Private ordinary functions

D
date-time-p: Private ordinary functions
datep: Private ordinary functions
def-checker: Private macros
def-checker: Private macros
def-validator: Private macros
default-id-fun: Private ordinary functions
defvfun: Private macros
dependencies: Private ordinary functions
dependent-required: Private ordinary functions
dependent-schemas: Private ordinary functions
description: Private ordinary functions
draft2019-09: Public ordinary functions
draft2019-09: Public ordinary functions
draft2019-09: Private ordinary functions
draft2019-09-id-fun: Private ordinary functions
draft3: Public ordinary functions
draft3: Public ordinary functions
draft3-timep: Private ordinary functions
draft4: Public ordinary functions
draft4: Public ordinary functions
draft4: Private ordinary functions
draft4-id-fun: Private ordinary functions
draft6: Public ordinary functions
draft6: Public ordinary functions
draft6: Private ordinary functions
draft7: Public ordinary functions
draft7: Public ordinary functions
draft7: Private ordinary functions
durationp: Private ordinary functions

E
emailp: Private ordinary functions
empty-object-p: Public ordinary functions
enum: Private ordinary functions
escape: Private ordinary functions
exclusive-maximum: Private ordinary functions
exclusive-minimum: Private ordinary functions

F
fetch-reference: Private ordinary functions
fetch-schema: Public ordinary functions
format-validator: Private ordinary functions
Function, $ref: Private ordinary functions
Function, %make-context: Private ordinary functions
Function, (setf context-named-references): Private ordinary functions
Function, (setf context-references): Private ordinary functions
Function, (setf context-root-schema): Public ordinary functions
Function, (setf context-schema-version): Public ordinary functions
Function, (setf context-uri-stack): Private ordinary functions
Function, absolute-uri: Private ordinary functions
Function, additional-items: Private ordinary functions
Function, additional-properties: Private ordinary functions
Function, all-of: Private ordinary functions
Function, any-of: Private ordinary functions
Function, any-p: Private ordinary functions
Function, array-p: Private ordinary functions
Function, boolean-p: Private ordinary functions
Function, check-dependencies: Private ordinary functions
Function, collect-subschemas: Private ordinary functions
Function, const: Private ordinary functions
Function, contains: Private ordinary functions
Function, context-named-references: Private ordinary functions
Function, context-p: Private ordinary functions
Function, context-references: Private ordinary functions
Function, context-root-schema: Public ordinary functions
Function, context-schema-version: Public ordinary functions
Function, context-uri-stack: Private ordinary functions
Function, copy-context: Private ordinary functions
Function, date-time-p: Private ordinary functions
Function, datep: Private ordinary functions
Function, default-id-fun: Private ordinary functions
Function, dependencies: Private ordinary functions
Function, dependent-required: Private ordinary functions
Function, dependent-schemas: Private ordinary functions
Function, description: Private ordinary functions
Function, draft2019-09: Public ordinary functions
Function, draft2019-09: Public ordinary functions
Function, draft2019-09: Private ordinary functions
Function, draft2019-09-id-fun: Private ordinary functions
Function, draft3: Public ordinary functions
Function, draft3: Public ordinary functions
Function, draft3-timep: Private ordinary functions
Function, draft4: Public ordinary functions
Function, draft4: Public ordinary functions
Function, draft4: Private ordinary functions
Function, draft4-id-fun: Private ordinary functions
Function, draft6: Public ordinary functions
Function, draft6: Public ordinary functions
Function, draft6: Private ordinary functions
Function, draft7: Public ordinary functions
Function, draft7: Public ordinary functions
Function, draft7: Private ordinary functions
Function, durationp: Private ordinary functions
Function, emailp: Private ordinary functions
Function, empty-object-p: Public ordinary functions
Function, enum: Private ordinary functions
Function, escape: Private ordinary functions
Function, exclusive-maximum: Private ordinary functions
Function, exclusive-minimum: Private ordinary functions
Function, fetch-reference: Private ordinary functions
Function, fetch-schema: Public ordinary functions
Function, format-validator: Private ordinary functions
Function, get-current-schema: Private ordinary functions
Function, get-current-uri: Private ordinary functions
Function, get-id-fun-for-schema-version: Public ordinary functions
Function, get-ref: Private ordinary functions
Function, hostnamep: Private ordinary functions
Function, if-validator: Private ordinary functions
Function, integer-p: Private ordinary functions
Function, ip-v4-address-p: Private ordinary functions
Function, ip-v6-address-p: Private ordinary functions
Function, items: Private ordinary functions
Function, json-equal-p: Public ordinary functions
Function, json-pointer-p: Private ordinary functions
Function, json-pretty-printer: Public ordinary functions
Function, lookup: Private ordinary functions
Function, make-context: Public ordinary functions
Function, make-empty-object: Public ordinary functions
Function, make-reference: Private ordinary functions
Function, make-relative-path-list: Private ordinary functions
Function, make-uri-without-fragment: Private ordinary functions
Function, max-items: Private ordinary functions
Function, max-length: Private ordinary functions
Function, max-properties: Private ordinary functions
Function, maximum: Private ordinary functions
Function, maximum-draft4: Private ordinary functions
Function, min-items: Private ordinary functions
Function, min-length: Private ordinary functions
Function, min-properties: Private ordinary functions
Function, minimum: Private ordinary functions
Function, minimum-draft4: Private ordinary functions
Function, multiple-of: Private ordinary functions
Function, noop: Private ordinary functions
Function, not-validator: Private ordinary functions
Function, null-p: Private ordinary functions
Function, object-equal-p: Public ordinary functions
Function, object-get: Public ordinary functions
Function, object-keys: Public ordinary functions
Function, object-p: Private ordinary functions
Function, one-of: Private ordinary functions
Function, parse: Public ordinary functions
Function, pattern: Private ordinary functions
Function, pattern-properties: Private ordinary functions
Function, pop-context: Private ordinary functions
Function, populate-named-references-for-schema: Private ordinary functions
Function, properties: Private ordinary functions
Function, property-names: Private ordinary functions
Function, push-context: Private ordinary functions
Function, ref-p: Private ordinary functions
Function, reference-eq: Private ordinary functions
Function, regexp: Private ordinary functions
Function, relative-reference-p: Public ordinary functions
Function, required: Private ordinary functions
Function, resolve: Public ordinary functions
Function, timep: Private ordinary functions
Function, type-validator: Private ordinary functions
Function, unescape: Private ordinary functions
Function, unevaluated-properties: Private ordinary functions
Function, unique-items: Private ordinary functions
Function, uri: Private ordinary functions
Function, uri-reference: Private ordinary functions
Function, validate: Public ordinary functions
Function, validate: Public ordinary functions
Function, validate-type: Private ordinary functions

G
Generic Function, (setf relative-path-of): Private generic functions
Generic Function, (setf uri-of): Private generic functions
Generic Function, relative-path-of: Private generic functions
Generic Function, uri-of: Private generic functions
get-current-schema: Private ordinary functions
get-current-uri: Private ordinary functions
get-id-fun-for-schema-version: Public ordinary functions
get-ref: Private ordinary functions

H
hostnamep: Private ordinary functions

I
if-validator: Private ordinary functions
integer-p: Private ordinary functions
ip-v4-address-p: Private ordinary functions
ip-v6-address-p: Private ordinary functions
items: Private ordinary functions

J
json-equal-p: Public ordinary functions
json-pointer-p: Private ordinary functions
json-pretty-printer: Public ordinary functions

L
lookup: Private ordinary functions

M
Macro, def-checker: Private macros
Macro, def-checker: Private macros
Macro, def-validator: Private macros
Macro, defvfun: Private macros
Macro, with-context: Public macros
Macro, with-lookup-depth-tracking: Private macros
Macro, with-pushed-context: Private macros
Macro, with-pushed-id: Public macros
Macro, with-resolved-ref: Public macros
make-context: Public ordinary functions
make-empty-object: Public ordinary functions
make-reference: Private ordinary functions
make-relative-path-list: Private ordinary functions
make-uri-without-fragment: Private ordinary functions
max-items: Private ordinary functions
max-length: Private ordinary functions
max-properties: Private ordinary functions
maximum: Private ordinary functions
maximum-draft4: Private ordinary functions
Method, (setf relative-path-of): Private generic functions
Method, (setf uri-of): Private generic functions
Method, print-object: Public standalone methods
Method, relative-path-of: Private generic functions
Method, uri-of: Private generic functions
min-items: Private ordinary functions
min-length: Private ordinary functions
min-properties: Private ordinary functions
minimum: Private ordinary functions
minimum-draft4: Private ordinary functions
multiple-of: Private ordinary functions

N
noop: Private ordinary functions
not-validator: Private ordinary functions
null-p: Private ordinary functions

O
object-equal-p: Public ordinary functions
object-get: Public ordinary functions
object-keys: Public ordinary functions
object-p: Private ordinary functions
one-of: Private ordinary functions

P
parse: Public ordinary functions
pattern: Private ordinary functions
pattern-properties: Private ordinary functions
pop-context: Private ordinary functions
populate-named-references-for-schema: Private ordinary functions
print-object: Public standalone methods
properties: Private ordinary functions
property-names: Private ordinary functions
push-context: Private ordinary functions

R
ref-p: Private ordinary functions
reference-eq: Private ordinary functions
regexp: Private ordinary functions
relative-path-of: Private generic functions
relative-path-of: Private generic functions
relative-reference-p: Public ordinary functions
required: Private ordinary functions
resolve: Public ordinary functions

T
timep: Private ordinary functions
type-validator: Private ordinary functions

U
unescape: Private ordinary functions
unevaluated-properties: Private ordinary functions
unique-items: Private ordinary functions
uri: Private ordinary functions
uri-of: Private generic functions
uri-of: Private generic functions
uri-reference: Private ordinary functions

V
validate: Public ordinary functions
validate: Public ordinary functions
validate-type: Private ordinary functions

W
with-context: Public macros
with-lookup-depth-tracking: Private macros
with-pushed-context: Private macros
with-pushed-id: Public macros
with-resolved-ref: Public macros


A.3 Variables

Jump to:   *   +  
C   E   F   M   N   P   R   S   U  
Index Entry  Section

*
*context*: Private special variables
*current-lookup-depth*: Private special variables
*http-connect-timeout*: Public special variables
*http-read-timeout*: Public special variables
*id-fun*: Private special variables
*resolve-remote-references*: Public special variables
*schema-version*: Public special variables
*schema-version*: Private special variables

+
+hostname-regex+: Private constants
+max-lookup-depth+: Private special variables
+unreserved-uri-characters+: Private constants

C
Constant, +hostname-regex+: Private constants
Constant, +unreserved-uri-characters+: Private constants

E
error-message: Public conditions

F
field-name: Private conditions

M
message: Public conditions

N
named-references: Private structures

P
property-name: Public conditions

R
references: Private structures
relative-path: Private classes
remote-uri: Public conditions
remote-uri: Public conditions
root-schema: Private structures

S
schema-version: Private structures
Slot, error-message: Public conditions
Slot, field-name: Private conditions
Slot, message: Public conditions
Slot, named-references: Private structures
Slot, property-name: Public conditions
Slot, references: Private structures
Slot, relative-path: Private classes
Slot, remote-uri: Public conditions
Slot, remote-uri: Public conditions
Slot, root-schema: Private structures
Slot, schema-version: Private structures
Slot, sub-errors: Public conditions
Slot, uri: Private classes
Slot, uri-stack: Private structures
Special Variable, *context*: Private special variables
Special Variable, *current-lookup-depth*: Private special variables
Special Variable, *http-connect-timeout*: Public special variables
Special Variable, *http-read-timeout*: Public special variables
Special Variable, *id-fun*: Private special variables
Special Variable, *resolve-remote-references*: Public special variables
Special Variable, *schema-version*: Public special variables
Special Variable, *schema-version*: Private special variables
Special Variable, +max-lookup-depth+: Private special variables
sub-errors: Public conditions

U
uri: Private classes
uri-stack: Private structures


A.4 Data types

Jump to:   C   F   J   N   O   P   R   S   T   U   V  
Index Entry  Section

C
Class, reference: Private classes
Condition, fetching-not-allowed-error: Public conditions
Condition, nested-reference-error: Public conditions
Condition, no-validator-condition: Private conditions
Condition, reference-error: Public conditions
Condition, remote-reference-error: Public conditions
Condition, validation-failed-error: Public conditions
context: Private structures

F
fetching-not-allowed-error: Public conditions
File, formats.lisp: The json-schema/formats․lisp file
File, json-schema.asd: The json-schema/json-schema․asd file
File, json-schema.lisp: The json-schema/json-schema․lisp file
File, parse.lisp: The json-schema/parse․lisp file
File, reference.lisp: The json-schema/reference․lisp file
File, types.lisp: The json-schema/types․lisp file
File, utils.lisp: The json-schema/utils․lisp file
File, validators.lisp: The json-schema/validators․lisp file
formats.lisp: The json-schema/formats․lisp file

J
json-array: Public types
json-boolean: Public types
json-null: Public types
json-schema: The json-schema system
json-schema: The json-schema package
json-schema.asd: The json-schema/json-schema․asd file
json-schema.formats: The json-schema․formats package
json-schema.lisp: The json-schema/json-schema․lisp file
json-schema.parse: The json-schema․parse package
json-schema.reference: The json-schema․reference package
json-schema.types: The json-schema․types package
json-schema.utils: The json-schema․utils package
json-schema.validators: The json-schema․validators package

N
nested-reference-error: Public conditions
no-validator-condition: Private conditions

O
object: Public types

P
Package, json-schema: The json-schema package
Package, json-schema.formats: The json-schema․formats package
Package, json-schema.parse: The json-schema․parse package
Package, json-schema.reference: The json-schema․reference package
Package, json-schema.types: The json-schema․types package
Package, json-schema.utils: The json-schema․utils package
Package, json-schema.validators: The json-schema․validators package
parse.lisp: The json-schema/parse․lisp file

R
reference: Private classes
reference-error: Public conditions
reference.lisp: The json-schema/reference․lisp file
remote-reference-error: Public conditions

S
schema: Public types
schema-version: Public types
Structure, context: Private structures
System, json-schema: The json-schema system

T
Type, json-array: Public types
Type, json-boolean: Public types
Type, json-null: Public types
Type, object: Public types
Type, schema: Public types
Type, schema-version: Public types
types.lisp: The json-schema/types․lisp file

U
utils.lisp: The json-schema/utils․lisp file

V
validation-failed-error: Public conditions
validators.lisp: The json-schema/validators․lisp file