ContentSchema

Interface

The field schema of a structured category. Articles in that category fill customData according to it, instead of a free-form body.

Property

Type

Optional

Description

fields

SchemaField[]

No

Field definitions, in editor order. Each key becomes a property of customData.


SchemaField

Interface

A single field definition in a content schema. Defines the structure, constraints, and display properties of one custom field.

Property

Type

Optional

Description

defaultValue

unknown

Yes

Value pre-filled on new content, of the type matching type. The field starts empty when unset.

fields

SchemaField[]

Yes

Sub-fields of an object field, or of each item of an array field. Can nest. Ignored for other types.

helpText

string

Yes

Help text shown below the field in the admin editor.

itemLabel

string

Yes

Label of one item in the admin editor of an array field, such as 'Slide'.

key

string

No

Property name in customData, unique within the schema, in lowercase letters, digits and underscores. Example: 'hero_image'.

label

string

No

Label shown above the field in the admin editor. Not part of the data.

maxItems

number

Yes

Maximum number of items of an array field, inclusive.

minItems

number

Yes

Minimum number of items of an array field, inclusive.

options

SchemaFieldOption[]

Yes

Options of a select or multiselect field. Ignored for other types.

placeholder

string

Yes

Placeholder shown in the empty input of the admin editor.

required

boolean

Yes

Whether a value is required when saving. Defaults to false.

type

SchemaFieldType

No

Field type, which sets the value shape in customData: see SchemaFieldType.<br>'object' and 'array' fields need fields, 'select' and 'multiselect' fields need options.

validation

SchemaFieldValidation

Yes

Validation rules for this field. See SchemaFieldValidation.


SchemaFieldOption

Interface

An option of a select or multiselect field.

Property

Type

Optional

Description

label

string

No

Label shown in the admin editor. Example: 'Red Color'.

value

string

No

Value stored in customData when the option is selected, unique within the field. Example: 'red'.


SchemaFieldType

TypeAlias

Field types of a content schema, and the value each one takes in customData:

Type

Value in customData

string

Plain text string

text

Multi-line text string

richtext

HTML string (converted from TipTap editor)

number

Numeric value (integer or float)

boolean

true or false

select

Single string from the options list

multiselect

Array of strings from the options list

image

Object { url, alt? } (read value.url)

file

Object { url, alt? } (read value.url)

url

Full URL string (validated)

email

Email address string (validated)

date

ISO 8601 date string (YYYY-MM-DD)

datetime

ISO 8601 datetime string

color

Hex color string (e.g. #ff5500)

object

Nested object with sub-fields

array

Array of objects with sub-fields

dataSource

Resolved data from a DataSource reference

TypeScript
type SchemaFieldType = "string" | "text" | "richtext" | "number" | "boolean" | "select" | "multiselect" | "image" | "file" | "url" | "email" | "date" | "datetime" | "color" | "object" | "array" | "dataSource"

SchemaFieldValidation

Interface

Validation rules of a schema field. Rules that do not fit the field's type are ignored.

Property

Type

Optional

Description

max

number

Yes

Maximum value, inclusive. For number fields.

maxLength

number

Yes

Maximum text length, inclusive. For string, text, richtext, url and email fields.

min

number

Yes

Minimum value, inclusive. For number fields.

minLength

number

Yes

Minimum text length, inclusive. For string, text, richtext, url and email fields.

pattern

string

Yes

JavaScript regular expression source, without delimiters or flags, for string and text fields. Example: '^[A-Z]{2,3}$'.