Skip to content
Alvo is pre-v0.1: the image runs from its edge tag, and no NuGet package or release is published yet.Pre-v0.1: no release yet.Roadmap and status

entities.fields

Entity fields.

Guide: Entities and fields

The entities block spans these pages: entities · entities · fields · entities · computed & rollups · entities · rules · entities · hooks · entities · indexes.

Entity fields. The id field (uuid, PK) is always added by the framework and cannot be declared, nor can the columns the entity’s traits add (tenant_id, the audit columns, deleted_at). Key = field name (snake_case). The names order, limit, offset, after, select, or, and and not are reserved and are rejected when the descriptor is applied: the generated Data API’s query string gives each of them a meaning (?limit=10, ?or=(...), ?not.color=eq.red), so a request could not tell a filter on such a field from the parameter itself. The pattern above cannot express that exclusion, which is why it is stated here rather than validated by the schema — rename the field.

  • Type: map of object
  • Required: yes
  • Names match ^[a-z][a-z0-9_]{0,62}$.

The field’s storage and validation type. decimal needs precision and scale; enum needs values; ref needs entity.

  • Type: string
  • Required: yes
  • Values: "string", "text", "integer", "decimal", "boolean", "date", "datetime", "uuid", "json", "enum", "ref"

Human-readable description of the field (surfaced to agents and in the admin UI).

  • Type: string
  • Required: no

Previous name of this field: declares a rename so apply preserves data instead of drop+add.

  • Type: string
  • Required: no
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$

Whether the field must be present (NOT NULL).

  • Type: boolean
  • Required: no
  • Default: false

Whether values must be unique across the entity.

  • Type: boolean
  • Required: no
  • Default: false

Explicitly allow NULL; the default is derived from required.

  • Type: boolean
  • Required: no

Default value: a JSON literal, or a tagged expression {“$cel”: ”…”} (e.g. {“$cel”: “now()”}, {“$cel”: “gen_random_uuid()”}, {“$cel”: “@user.id”}). The $cel default context includes @user/@tenant and is evaluated at insert time.

  • Type: any
  • Required: no
  • Not allowed together with computed.
  • Not allowed together with rollup.

entities.<name>.fields.<name>.default.$cel

Section titled “entities.<name>.fields.<name>.default.$cel”

A CEL expression whose result becomes the value, in place of a JSON literal (e.g. now(), @user.id).

  • Type: string
  • Required: yes

type=string only. Counted in Unicode code points — the unit JSON Schema’s own maxLength keyword and PostgreSQL’s varchar(n) both use — not UTF-16 code units, so a character outside the Basic Multilingual Plane counts once. Both shipped drivers honour that bound; a dialect whose column counts UTF-16 units owes its own answer.

  • Type: integer
  • Required: no
  • Allowed only when type is "string".

type=decimal only (required).

  • Type: integer
  • Required: no
  • Required when type is "decimal".
  • Allowed only when type is "decimal".

type=decimal only (required).

  • Type: integer
  • Required: no
  • Required when type is "decimal".
  • Allowed only when type is "decimal".

type=enum only.

  • Type: array of string
  • Required: no
  • Required when type is "enum".
  • Allowed only when type is "enum".

type=ref only — target entity (FK to its id). May target the reserved users entity, or a dynamic/runtime entity (late-bound).

  • Type: string
  • Required: no
  • Pattern: ^[a-z][a-z0-9_-]{0,62}$
  • Required when type is "ref".
  • Allowed only when type is "ref".

type=ref only. Registry-level semantics: enforced as a DB FK for physical targets, app-enforced for dynamic targets.

  • Type: string
  • Required: no
  • Values: "restrict", "cascade", "setNull"
  • Default: "restrict"
  • Allowed only when type is "ref".

type=string only — validation format: a built-in (email, uri, phone) or the name of a format declared in the top-level formats. An unknown name is caught fail-fast at apply (like a ref to a missing entity), not by this schema.

  • Type: string
  • Required: no
  • Allowed only when type is "string".

Optional CEL value validation (context: value, new).

  • Type: string
  • Required: no

Create an index (for dynamic entities = generated column + index over the JSON path).

  • Type: boolean
  • Required: no
  • Default: false

Field is never returned in API responses. true = always hidden; a CEL expression over @user makes visibility conditional (per-role masking, e.g. ”!(‘compliance’ in @user.roles)”).

  • Type: boolean or string
  • Required: no

Field cannot be modified via the API. true = always read-only; a CEL expression over @user makes it conditional.

  • Type: boolean or string
  • Required: no