Skip to content

Schema Language

Syntax and properties that schepta understands — the "vocabulary" for defining dynamic interfaces.

Schema Language

Schema Language defines how to write JSON that schepta can interpret:

Essential Properties:

PropertyFunctionValueResult
x-componentDefines which component to use"InputText"Specific React/Vue component
x-component-propsProps for the component{ placeholder: "Email" }Props passed directly
x-uiLayout and visual{ order: 1 }Ordering and positioning
x-rulesValidation and rules{ required: true }Automatic validation
nameUnique 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"
  }
}

Result: Structured JSON → Working React/Vue component. Simple and powerful syntax!

Core Properties

Fundamental properties that every schema should know:

Component Definition:

PropertyRequiredTypeDescriptionExample
x-componentYesstringComponent name"InputText", "MenuLink"
x-component-propsNoobjectComponent props{ variant: "outlined" }
typeContextstringSchema type"string", "object"
nameNo (forms)stringField identifier"email", "password"

Visual & Layout:

PropertyRequiredTypeDescriptionExample
x-uiNoobjectUI configuration{ order: 1, grid: { xs: 12 } }
titleNostringDisplay label"Email Address"
descriptionNostringHelp text"Enter your work email"
placeholderNostringInput placeholder"user@company.com"

Behavior & Logic:

PropertyRequiredTypeDescriptionExample
x-contentNostringStatic content (e.g. button label)"Submit Form"

Dynamic values: Use template expressions in x-component-props (or other props) with {{ $formValues.fieldName }} and {{ $externalContext.property }}. The template middleware replaces these at runtime. See Expression Language below.

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": "FormContainer",
  "properties": {
    "fieldKey1": { /* field schema */ },
    "fieldKey2": { /* field schema */ }
  }
}

Responsive & Layout

PropertyConfigurationPurposeExample
x-ui.gridGrid systemResponsive layout{ xs: 12, md: 6, lg: 4 }
x-ui.ordernumberDisplay order1, 2, 3
x-ui.spannumberColumn span2 (spans 2 columns)
x-ui.offsetnumberColumn offset1 (offset by 1 column)

Expression Language

Syntax for dynamic expressions within schemas. Expressions are processed by the template middleware and support $formValues and $externalContext.

Expression Types:

Expression TypeSyntaxContextExample
Form values{{ $formValues.fieldName }}Current form state"{{ $formValues.email }}"
External context{{ $externalContext.property }}Provider externalContext"{{ $externalContext.user.name }}"

Operators Available:

OperatorUsageExampleResult
===, !==Equality"{{ $externalContext.role === 'admin' }}"boolean
&&, ||Logical"{{ $formValues.type === 'user' && $externalContext.plan === 'premium' }}"boolean
>, <, >=, <=Comparison"{{ $formValues.age >= 18 }}"boolean

Expressions can be used inside strings in props (e.g. in x-component-props) and are evaluated with the current form values and external context.

Schema Language is the "syntax" that connects all concepts: