ObjectStackObjectStack Protocol

Schema Definition

The core of ObjectQL. How to define Objects, Fields, and Relationships using declarative protocols.

In ObjectStack, data structure is defined via Configuration, not Code. The Schema Definition Protocol governs how you declare your Data Model (Objects) and your Data Dictionary (Fields).

Single Source of Truth: This schema drives Database DDL, API Generation, UI Form Layouts, and Permission Scopes.

1. The Object Definition

An Object represents a business entity (like a Table in SQL or Collection in NoSQL).

# project.object.yml
name: project               # Machine Name (snake_case, unique)
label: Project              # Human Label
icon: standard:case         # Icon from SLDS or standard set
bucket: main                # Database connection/shard key
enable:                     # Capabilities
  audit: true               # Track field history
  workflow: true            # Allow process builder
  full_text_search: true    # Index for global search
description: "A business project or initiative."
fields:
  name:
    type: text
    label: Project Name
    required: true
  status:
    type: select
    options:
      - label: Draft
        value: draft
      - label: Active
        value: active

Key Properties

PropertyTypeDescription
namestringRequired. Unique identifier. Must be snake_case.
labelstringRequired. Display label for UI.
fieldsMap<string, Field>Dictionary of fields.
datasourcestringThe external datasource ID (if not storing in default DB).

2. The Field Definition

Fields define the columns or attributes of the Object.

# In-line definition or separate .field.yml
type: number
scale: 2
precision: 18
defaultValue: 0
required: true
index: true           # Create DB Index
unique: false         # Enforce Uniqueness

Core Field Types

See Advanced Types for the full list.

  • text, textarea, html
  • number, currency, percent
  • date, datetime
  • boolean
  • select (Picklist)
  • lookup, master_detail (Foreign Keys)
  • formula, summary (Derived)

3. The Validation Protocol

Validation logic is declarative and runs on the server (and compiled to client-side logic where possible).

validation_rules:
  - name: start_before_end
    condition: "end_date < start_date"
    message: "End Date must be after Start Date"

4. Derived Schemas

The Protocol allows for Schema Derivation. You can define a base object and extend it, though ObjectStack prefers Composition via mixins or separate relation tables over classical OOP inheritance.

On this page