Skip to main content
Module

x/spartanschema/mod.ts

Ultra-minimal JSON schemas with Typescript inference
Latest
import * as spartanschema from "https://deno.land/x/spartanschema@v1.1.1/mod.ts";

Classes

A detailed error thrown by assertMatchesSchema when schema validation fails. Includes the schema, the JSON that didn't match, and the list of validation errors, complete with JSONPath locations in both the schema and the JSON value.

Functions

A curried function that checks whether value matches schema and throws a SchemaAssertionError if it doesn't.

A type predicate that checks whether schema is a valid Spartan Schema.

A curried function that checks whether value matches schema and returns a boolean.

Returns a parseable string representation of a Path, in JSONPath format.

Returns the zero value of this schema's root type.

Interfaces

The type of valid Spartan Schemas.

Type Aliases

Given a type S that describes the exact shape of a Schema, MatchesSchema<S> is the type of values that match that schema.

A more general type than PathArray, for any iterable value that can describe a specific location in a JSON document.

A path to a specific location in a JSON document.