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: activeKey Properties
| Property | Type | Description |
|---|---|---|
name | string | Required. Unique identifier. Must be snake_case. |
label | string | Required. Display label for UI. |
fields | Map<string, Field> | Dictionary of fields. |
datasource | string | The 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 UniquenessCore Field Types
See Advanced Types for the full list.
text,textarea,htmlnumber,currency,percentdate,datetimebooleanselect(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.