Interface JsonSchema7

interface JsonSchema7 {
    $id?: string;
    $ref?: string;
    $schema?: string;
    additionalItems?: boolean | JsonSchema7;
    additionalProperties?: boolean | JsonSchema7;
    allOf?: JsonSchema7[];
    anyOf?: JsonSchema7[];
    const?: any;
    contains?: JsonSchema7;
    default?: any;
    definitions?: {
        [key: string]: JsonSchema7;
    };
    dependencies?: {
        [key: string]: JsonSchema7 | string[];
    };
    description?: string;
    else?: JsonSchema7;
    enum?: any[];
    errorMessage?: any;
    examples?: any[];
    exclusiveMaximum?: number;
    exclusiveMinimum?: number;
    format?: string;
    if?: JsonSchema7;
    items?: JsonSchema7 | JsonSchema7[];
    maxItems?: number;
    maxLength?: number;
    maxProperties?: number;
    maximum?: number;
    minItems?: number;
    minLength?: number;
    minProperties?: number;
    minimum?: number;
    multipleOf?: number;
    not?: JsonSchema7;
    oneOf?: JsonSchema7[];
    pattern?: string;
    patternProperties?: {
        [pattern: string]: JsonSchema7;
    };
    properties?: {
        [property: string]: JsonSchema7;
    };
    propertyNames?: JsonSchema7;
    readOnly?: boolean;
    required?: string[];
    then?: JsonSchema7;
    title?: string;
    type?: string | string[];
    uniqueItems?: boolean;
    writeOnly?: boolean;
}

Properties

$id?: string

This is important because it tells refs where the root of the document is located

$ref?: string
$schema?: string

It is recommended that the meta-schema is included in the root of any JSON Schema

additionalItems?: boolean | JsonSchema7
additionalProperties?: boolean | JsonSchema7
allOf?: JsonSchema7[]
anyOf?: JsonSchema7[]
const?: any
contains?: JsonSchema7
default?: any

Default json for the object represented by this schema

definitions?: {
    [key: string]: JsonSchema7;
}

Holds simple JSON Schema definitions for referencing from elsewhere.

Type declaration

dependencies?: {
    [key: string]: JsonSchema7 | string[];
}

If the key is present as a property then the string of properties must also be present. If the value is a JSON Schema then it must also be valid for the object if the key is present.

Type declaration

description?: string

Schema description

enum?: any[]

Enumerates the values that this schema can be e.g. {"type": "string", "enum": ["red", "green", "blue"]}

errorMessage?: any
examples?: any[]
exclusiveMaximum?: number

If true maximum must be > value, >= otherwise

exclusiveMinimum?: number

If true minimum must be < value, <= otherwise

format?: string
maxItems?: number
maxLength?: number
maxProperties?: number
maximum?: number
minItems?: number
minLength?: number
minProperties?: number
minimum?: number
multipleOf?: number

The value must be a multiple of the number (e.g. 10 is a multiple of 5)

The entity being validated must not match this schema

oneOf?: JsonSchema7[]
pattern?: string

This is a regex string that the value must conform to

patternProperties?: {
    [pattern: string]: JsonSchema7;
}

The key of this object is a regex for which properties the schema applies to

Type declaration

properties?: {
    [property: string]: JsonSchema7;
}

The keys that can exist on the object with the json schema that should validate their value

Type declaration

propertyNames?: JsonSchema7
readOnly?: boolean
required?: string[]
title?: string

Title of the schema

type?: string | string[]

The basic type of this schema, can be one of [string, number, object, array, boolean, null] or an array of the acceptable types

uniqueItems?: boolean
writeOnly?: boolean

Generated using TypeDoc