Validation
What the engine checks at build time, and where custom rules belong.
Validation comes from a few places. Reach for the cheapest one that fits; only fall back to a server hook when nothing declarative does.
| Need | Mechanism |
|---|---|
primitive shape (string/number/boolean/date) + min/max/length/regex/precision | built-in field type (declarative) |
| required / unique | required / unique (column UNIQUE) / object constraints |
| custom local rule | a registered type's pure validate hook (any base) |
| value from a data set (codes, stringified) | enum + options.from |
| reference to an entity (navigate/join) | relation / multiRelation |
| cross-field / state / aggregate / bespoke DB rule | server hook validate |
Build-time rules
- Object and field names must be
snake_case. - Every object declares at least one
primaryscalar field (several = a composite key). The object name is the table name. relation/details/multiRelationtargets must exist. The check runs across the whole set (buildGraph).- Details children cannot declare the reserved
parent_*columns. - Formula fields cannot be
required/unique/primary, and cannot have constraints. read/manage: ownrequires anownershipfield;departmentrequires adepartmentorownershipfield — see RBAC.
Computed fields
A formula on a scalar field computes a read-only value on write — see
Formulas.
Related
- Fields & types
- Migrations
- Script subsystem — the escape hatch for real logic