Skip to content

Schema

A description of the values that a facet accepts. It uses a subset of JSON Schema: type, properties, required, items, enum, minimum, maximum, minLength, maxLength, pattern and format, nested up to a depth of 8.

const schema = { type: 'object', properties: { date: { type: 'string', format: 'day' } }, required: ['date'] };
enum?: (string | number | boolean | null)[];

The only values that are accepted.


format?: SchemaFormat;

For a text, a format that the text must have: day, time, date-time or uri.


items?: Schema;

For an array, the schema of its elements.


maximum?: number;

For a number, the largest accepted value.


maxLength?: number;

For a text, the largest accepted length.


minimum?: number;

For a number, the smallest accepted value.


minLength?: number;

For a text, the smallest accepted length.


pattern?: string;

For a text, a regular expression that the text must match.


properties?: Record<string, Schema>;

For an object, the schema of each property, by name.


required?: string[];

For an object, the names of the properties that must be present.


type?: SchemaType;

The type of the value: string, number, integer, boolean, object, array or null.