Schema Language β
Syntax and properties that schepta understands β the "vocabulary" for defining dynamic interfaces.

Schema Language defines how to write JSON that schepta can interpret:
π§ Essential Properties: β
| Property | Function | Value | Result |
|---|---|---|---|
x-component | Defines which component to use | "InputText" | Specific React/Vue component |
x-component-props | Props for the component | { placeholder: "Email" } | Props passed directly |
x-ui | Layout and visual | { order: 1 } | Ordering and positioning |
x-rules | Validation and rules | { required: true } | Automatic validation |
name | Unique identifier | "email" | Identified field |
π Basic Syntax: β
Form Field:
json
{
"name": "email",
"x-component": "InputText",
"x-component-props": {
"placeholder": "Enter your email"
},
"x-rules": {
"required": true,
"pattern": "email"
}
}Menu Item:
json
{
"type": "object",
"x-component": "MenuLink",
"x-component-props": {
"label": "Dashboard",
"href": "/dashboard",
"icon": "dashboard"
},
"active": "\{\{ $segment.role === 'admin' \}\}"
}π‘ Result: Structured JSON β Working React/Vue component. Simple and powerful syntax!
π Core Properties β
Fundamental properties that every schema should know:
π― Component Definition: β
| Property | Required | Type | Description | Example |
|---|---|---|---|---|
x-component | β Yes | string | Component name | "InputText", "MenuLink" |
x-component-props | β No | object | Component props | { variant: "outlined" } |
type | β Context | string | Schema type | "string", "object" |
name | β Forms | string | Field identifier | "email", "password" |
π¨ Visual & Layout: β
| Property | Required | Type | Description | Example |
|---|---|---|---|---|
x-ui | β No | object | UI configuration | { order: 1, grid: { xs: 12 } } |
title | β No | string | Display label | "Email Address" |
description | β No | string | Help text | "Enter your work email" |
placeholder | β No | string | Input placeholder | "user@company.com" |
β‘ Behavior & Logic: β
| Property | Required | Type | Description | Example |
|---|---|---|---|---|
x-rules | β No | object | Validation rules | { required: true, minLength: 8 } |
x-reactions | β No | object | Dynamic behavior | { visible: "\{\{ $form.type === 'admin' \}\}" } |
active | β Menus | boolean/string | Active state | true or "\{\{ $segment.role === 'admin' \}\}" |
visible | β No | boolean/string | Visibility control | "\{\{ $form.plan !== 'basic' \}\}" |
π Schema Types β
Different schema types for different use cases:
π Form Schemas: β
Field Schema Structure:
json
{
"name": "fieldName",
"x-component": "ComponentName",
"x-component-props": {
"prop1": "value1",
"prop2": "value2"
},
"x-rules": {
"required": true,
"pattern": "regex",
"minLength": 5
},
"x-ui": {
"order": 1,
"grid": { "xs": 12, "md": 6 }
}
}Form Container Schema:
json
{
"type": "object",
"x-component": "form-container",
"properties": {
"fieldKey1": { /* field schema */ },
"fieldKey2": { /* field schema */ }
}
}βοΈ Advanced Properties β
Advanced properties for specific cases:
π§ Component Extensions: β
| Property | Purpose | Usage | Example |
|---|---|---|---|
x-decorator | Wrapper component | Field decoration | "FormItem" |
x-decorator-props | Decorator props | Decorator configuration | { label: "Field Label" } |
x-content | Static content | Text/HTML content | "Submit Form" |
x-data | Static data | Pre-filled data | { options: ["A", "B"] } |
π― Conditional Logic: β
| Property | Type | Purpose | Example |
|---|---|---|---|
x-visible | boolean/string | Show/hide component | "\{\{ $form.type === 'premium' \}\}" |
x-disabled | boolean/string | Enable/disable | "\{\{ $form.readonly \}\}" |
x-pattern | object | Display patterns | { loading: "\{\{ $form.isLoading \}\}" } |
x-validator | string/function | Custom validation | "validateCPF" |
π± Responsive & Layout: β
| Property | Configuration | Purpose | Example |
|---|---|---|---|
x-ui.grid | Grid system | Responsive layout | { xs: 12, md: 6, lg: 4 } |
x-ui.order | number | Display order | 1, 2, 3 |
x-ui.span | number | Column span | 2 (spans 2 columns) |
x-ui.offset | number | Column offset | 1 (offset by 1 column) |
π Expression Language β
Syntax for dynamic expressions within schemas:
π Expression Types: β
| Expression Type | Syntax | Context | Example |
|---|---|---|---|
| Form State | \{\{ $form.fieldName \}\} | Form values | "\{\{ $form.email \}\}" |
| Segment Context | \{\{ $segment.property \}\} | User context | "\{\{ $segment.role \}\}" |
| Association Target | \{\{ $target.property \}\} | Linked configs | "\{\{ $target.locale.title \}\}" |
| External Context | \{\{ $context.property \}\} | External data | "\{\{ $context.user.name \}\}" |
β‘ Operators Available: β
| Operator | Usage | Example | Result |
|---|---|---|---|
===, !== | Equality | "\{\{ $segment.role === 'admin' \}\}" | boolean |
&&, || | Logical | "\{\{ $form.type === 'user' && $segment.plan === 'premium' \}\}" | boolean |
>, <, >=, <= | Comparison | "\{\{ $form.age >= 18 \}\}" | boolean |
contains() | Array/string contains | "\{\{ contains($segment.roles, 'admin') \}\}" | boolean |
startsWith() | String starts | "\{\{ startsWith($form.email, 'admin') \}\}" | boolean |
π‘ Related Concepts β
Schema Language is the "syntax" that connects all concepts:
- 01. Factories: Factories interpret Schema Language
- 04. Schema Resolution: Pipeline that processes the syntax
- 05. Renderer: Renderers execute schema properties
- 06. Middleware: Pipeline transforms schema properties
- 03. Provider: Configures components and contexts used in schemas
- 07. Debug System: Debug shows how schemas are interpreted