Download

Object Schema

An Object Schema is the central definition of a system business entity.

An object schema defines:

  • the data structure
  • validation rules
  • available API fields
  • data access permissions
  • administrative interface behaviour

Based on Object Schemas, the framework automatically generates:

  • API actions
  • administrative panel pages
  • data validation rules
  • relationships between objects
Property Type Description
title string Name. Used as documentation for developers.
table string The database table associated with the schema.
is_trash boolean Whether soft deletion is enabled. Uses the `is_active` field in the database.
properties * array Object properties.

table

Each object is typically associated with a single database table defined by a DB Schema.

The DB Schema is responsible for the physical storage of data.

The Object Schema defines the business logic for working with that data.

properties

Property Type Description
title * string Name.
article * string Unique identifier.
data_type * string Data type accepted by the API.
field_type * string Field type used in the administrative interface.
size integer Field width (from 1 to 4).
is_unique boolean Whether the value must be unique.
is_autofill boolean Auto-fill. Determines whether the property is automatically passed to standard action scripts.
is_default_in_list boolean Whether the property is displayed in list views.
use_in_actions array Actions in which the property is available. The field is ignored in all other actions.
require_in_actions array Actions for which the property is required.
required_permissions array Permission identifiers required to access the property.
settings object Additional field settings (depend on the `field_type`).

Example: use_in_actions

The `email` field is available only in the `add` and `update` actions. It is ignored in all other actions.


{
    "article": "email",
    "data_type": "email",
    "field_type": "email",
    "is_unique": true,
    "use_in_actions": [
        "add",
        "update"
    ]
}

Example: require_in_actions

The `email` field is required when creating a record but optional when updating one.


{
    "article": "email",
    "data_type": "email",
    "field_type": "email",
    "is_unique": true,
    "use_in_actions": [
        "add",
        "update"
    ],
    "require_in_actions": [
        "add"
    ]
}

Example: required_permissions

A user without the `employees_salary` permission cannot:

  • view the field
  • modify the field
  • use the field in API requests

{
    "article": "salary",
    "data_type": "float",
    "field_type": "price",
    "required_permissions": [
        "employees_salary"
    ]
}

data_type List

Type Description
integer Integer
float Floating-point number
string String
password Password
phone Phone number
email Email address
datetime Date and time
date Date
time Time
array Array

field_type List

Type Description
string Text field
textarea Multi-line text area
editor Rich text editor
email Email field
password Password field
integer Integer field
float Floating-point field
price Price
phone Phone number
list Dropdown list
multiply_list Multi-select list
datetime Date and time
date Date
time Time
year Year
layout Template (HTML layout)
checkbox Checkboxes
image Image

list field_type

A list can be populated in two ways:

  • from a donor table (`donor_table`, `donor_property_title`)
  • from a custom list (`custom_list`)

Settings:

Property Type Description
donor_table string Donor table from which records are retrieved.
donor_property_title string Property of the donor table used as the display title.
is_search boolean Whether search is used to retrieve values.
custom_list array Custom list.

custom_list

Property Type Description
title * string List item title.
value * string List item value.
color string List item colour.

color

  • light
  • secondary
  • primary
  • success
  • info
  • warning
  • danger
  • dark

multiply_list

Property Type Description
donor_table * string Donor table from which records are retrieved.
donor_property_title * string Property of the donor table used as the display title.
connection_table * string Junction table.
connection_donor_property * string Junction table property linked to the recipient property.
connection_recipient_property * string Junction table property linked to the donor property.
is_search boolean Whether search is used to retrieve values.

Complete Object Schema Example


{
    "title": "Clients",
    "table": "clients",
    "is_trash": true,
    "properties": [
        {
            "title": "First name",
            "article": "first_name",
            "data_type": "string",
            "field_type": "string",
            "is_default_in_list": true,
            "is_unique": false,
            "is_autofill": true,
            "required_permissions": [],
            "use_in_actions": ["add", "update"],
            "require_in_actions": ["add"]
        },
        {
            "title": "Last name",
            "article": "last_name",
            "data_type": "string",
            "field_type": "string",
            "is_default_in_list": true,
            "is_unique": false,
            "is_autofill": true,
            "required_permissions": [],
            "use_in_actions": ["add", "update"],
            "require_in_actions": []
        },
        {
            "title": "Patronymic",
            "article": "patronymic",
            "data_type": "string",
            "field_type": "string",
            "is_default_in_list": false,
            "is_unique": false,
            "is_autofill": true,
            "required_permissions": [],
            "use_in_actions": ["add", "update"],
            "require_in_actions": []
        },
        {
            "title": "Email",
            "article": "email",
            "data_type": "email",
            "field_type": "email",
            "is_default_in_list": false,
            "is_unique": true,
            "is_autofill": true,
            "required_permissions": [],
            "use_in_actions": ["add", "update"],
            "require_in_actions": []
        },
        {
            "title": "Phone",
            "article": "phone",
            "data_type": "phone",
            "field_type": "phone",
            "is_default_in_list": false,
            "is_unique": true,
            "is_autofill": true,
            "required_permissions": [],
            "use_in_actions": ["add", "update"],
            "require_in_actions": []
        }
    ]
}