The root object of a JSON Schema document.

interface RootSchema {
    $id?: string;
    $ref?: string;
    $schema?: string;
    additionalItems?: Schema;
    additionalProperties?: Schema;
    allOf?: Schema[];
    anyOf?: Schema[];
    const?: { [k: string]: unknown };
    contains?: Schema;
    default?: { [k: string]: unknown };
    definitions?: { [k: string]: Schema };
    deprecated?: boolean;
    description?: string;
    else?: Schema;
    enum?: true[];
    examples?: true[];
    exclusiveMaximum?: number;
    exclusiveMinimum?: number;
    format?: string;
    if?: Schema;
    items?: SingleOrVecFor_Schema;
    maximum?: number;
    maxItems?: number;
    maxLength?: number;
    maxProperties?: number;
    minimum?: number;
    minItems?: number;
    minLength?: number;
    minProperties?: number;
    multipleOf?: number;
    not?: Schema;
    oneOf?: Schema[];
    pattern?: string;
    patternProperties?: { [k: string]: Schema };
    properties?: { [k: string]: Schema };
    propertyNames?: Schema;
    readOnly?: boolean;
    required?: string[];
    then?: Schema;
    title?: string;
    type?: SingleOrVecFor_InstanceType;
    uniqueItems?: boolean;
    writeOnly?: boolean;
    [k: string]: unknown;
}

Indexable

  • [k: string]: unknown

Properties

$id?: string
$ref?: string
$schema?: string

The $schema keyword.

See JSON Schema 8.1.1. The "$schema" Keyword.

additionalItems?: Schema

The additionalItems keyword.

See JSON Schema 9.3.1.2. "additionalItems".

additionalProperties?: Schema

The additionalProperties keyword.

See JSON Schema 9.3.2.3. "additionalProperties".

allOf?: Schema[]

The allOf keyword.

See JSON Schema 9.2.1.1. "allOf".

anyOf?: Schema[]

The anyOf keyword.

See JSON Schema 9.2.1.2. "anyOf".

const?: { [k: string]: unknown }
contains?: Schema

The contains keyword.

See JSON Schema 9.3.1.4. "contains".

default?: { [k: string]: unknown }

The default keyword.

See JSON Schema Validation 9.2. "default".

definitions?: { [k: string]: Schema }

The definitions keyword.

In JSON Schema draft 2019-09 this was replaced by $defs, but in Schemars this is still serialized as definitions for backward-compatibility.

See JSON Schema 8.2.5. Schema Re-Use With "$defs", and JSON Schema (draft 07) 9. Schema Re-Use With "definitions".

deprecated?: boolean

The deprecated keyword.

See JSON Schema Validation 9.3. "deprecated".

description?: string
else?: Schema

The else keyword.

See JSON Schema 9.2.2.3. "else".

enum?: true[]
examples?: true[]

The examples keyword.

See JSON Schema Validation 9.5. "examples".

exclusiveMaximum?: number

The exclusiveMaximum keyword.

See JSON Schema Validation 6.2.3. "exclusiveMaximum".

exclusiveMinimum?: number

The exclusiveMinimum keyword.

See JSON Schema Validation 6.2.5. "exclusiveMinimum".

format?: string
if?: Schema

The if keyword.

See JSON Schema 9.2.2.1. "if".

The items keyword.

See JSON Schema 9.3.1.1. "items".

maximum?: number

The maximum keyword.

See JSON Schema Validation 6.2.2. "maximum".

maxItems?: number

The maxItems keyword.

See JSON Schema Validation 6.4.1. "maxItems".

maxLength?: number

The maxLength keyword.

See JSON Schema Validation 6.3.1. "maxLength".

maxProperties?: number

The maxProperties keyword.

See JSON Schema Validation 6.5.1. "maxProperties".

minimum?: number

The minimum keyword.

See JSON Schema Validation 6.2.4. "minimum".

minItems?: number

The minItems keyword.

See JSON Schema Validation 6.4.2. "minItems".

minLength?: number

The minLength keyword.

See JSON Schema Validation 6.3.2. "minLength".

minProperties?: number

The minProperties keyword.

See JSON Schema Validation 6.5.2. "minProperties".

multipleOf?: number

The multipleOf keyword.

See JSON Schema Validation 6.2.1. "multipleOf".

not?: Schema

The not keyword.

See JSON Schema 9.2.1.4. "not".

oneOf?: Schema[]

The oneOf keyword.

See JSON Schema 9.2.1.3. "oneOf".

pattern?: string

The pattern keyword.

See JSON Schema Validation 6.3.3. "pattern".

patternProperties?: { [k: string]: Schema }

The patternProperties keyword.

See JSON Schema 9.3.2.2. "patternProperties".

properties?: { [k: string]: Schema }

The properties keyword.

See JSON Schema 9.3.2.1. "properties".

propertyNames?: Schema

The propertyNames keyword.

See JSON Schema 9.3.2.5. "propertyNames".

readOnly?: boolean
required?: string[]

The required keyword.

See JSON Schema Validation 6.5.3. "required".

then?: Schema

The then keyword.

See JSON Schema 9.2.2.2. "then".

title?: string
uniqueItems?: boolean

The uniqueItems keyword.

See JSON Schema Validation 6.4.3. "uniqueItems".

writeOnly?: boolean