Schema Fields

When you create a schema, it will have by default an array of fields, with a "title" field. The "title" field cannot be removed.

Schema fields describe the fields that your documents will have.

Defining the Field Object Structure

{
    "id": "title",
    "name": "Title",
    "type": "text",
    "status": "active",
    "ui": "textarea",
    "help": "",
    "options": {
        "options": "cddd57b7-0571-4a51-9bb3-34bfa22233ed",
        "subschemas": [
            "subschema"
        ],
        "source": "title",
        "localized": true,
        "repeatable": true,
        "permanent": true,
        "default": true
    },
    "validation": {
        "length": 5,
        "min": 4,
        "max": 10,
        "url": true,
        "email": true,
        "unique": true
    }
}

Field Variables

Field Type Description
id (unique) string (min:3, max:120, alphadash) An alphadash string. This is set on creation and cannot be changed later
name string (min:3, max:120) The name of the Field
type string The type of the Field (More info here). This is set on creation and cannot be changed later
status string (default:"active", "inactive") Whether the Field is active or not
ui string The UI that is used by Lucent CMS (not relevant to developers)
help string (default:"") A help text for describing the Field
options Options Object An object containing all the Field Options
validation Validation Object An object containing all the Field Validation options

Options Variables

Field Type Description
options uuid The uuid of the resource you want the values from
subschemas array of Subschema keys An array containing all the Subschema keys you can create a Subdocument from
source Field Id A Field Id used in Slug Fields. It contains which field you want to slugify
localised bool Whether the field is localised, or not
repeatable bool Whether the field can have more than one values
permanent bool Whether the field is permanent, thus cannot be deleted, or not
default bool Used in Bool Fields. It sets the field to True/False by default
decimals int Used in Number Fields. It specifies how many decimals a number can have

Validation Variables

Field Type Description
length int Used in repeatable Fields. It specifies how many values the Field can have
min int The minimum of characters a value can have
max int The maximum of characters a value can have
url bool Used in Text Fields. Checks if the value is a valid URL
email bool Used in Text Fields. Checks if the value is a valid email
unique bool Checks if the value is unique inside the schema