Skip to content

From JSON to Components

System that interprets JSON schemas and transforms them into React/Vue elements — the "translator" between backend and frontend.

Schema Resolution

Schema Resolution is the process that transforms JSON configurations into functional interfaces:

What It Does:

InputProcessOutputResult
JSON SchemaResolution + ValidationReact/Vue Element TreeRendered interface
Component specsLookup (defaults + Provider + local)Component instancesWorking components
Props and contextMiddleware pipelineEnhanced propsCorrect behavior

Resolution Flow:

Automatic Steps:

  1. Schema Parsing: JSON → Internal structure
  2. Component Lookup: x-component (and optional x-custom) → Component from merged registry
  3. Props Resolution: Schema properties → Component props
  4. Context Injection: Form adapter, external context → available to components
  5. Middleware Application: Props transformation (e.g. template expressions)
  6. Element Creation: React.createElement() / Vue h() calls

Visual Example:

json
{ "name": "email", "x-component": "InputText", "required": true }

Resolution Process

jsx
<InputText name="email" required={true} onChange={...} />

Result: Declarative schema → Imperative component.

Resolution Types

Form Schema Resolution:

Schema PropertyResolution StrategyReact/Vue ResultExample
nameField identificationname prop<input name="email" />
x-componentComponent lookup from merged registryComponent type<InputText />
requiredValidation rulerequired prop + validationrequired={true}
x-component-propsProps passthrough (after template processing)Direct propsplaceholder="Enter email"
x-rulesValidation configurationValidation propspattern="email"

Component Schema Resolution:

Schema PropertyResolution StrategyReact/Vue ResultExample
x-componentComponent type lookupComponent class<Button />
x-uiLayout/styling propsPassed to componentLayout props
x-component-propsComponent-specific props (template expressions resolved)Props object{ variant: "primary" }

Resolution Engine

How the system resolves schemas internally:

Resolution Pipeline:

Raw JSON Schema

Validate Schema (Valid structure?)

Resolve Component (Lookup: customComponents for x-custom, else merged components)

Map Props (Schema → Component props)

Inject Context (formValues, externalContext)

Apply Middleware (e.g. template expressions)

Create Element (React.createElement / Vue h())

Final React/Vue Element

Resolution Priorities:

Component Resolution:

  • When a schema node has x-custom: true, the resolver looks up the node key in customComponents (Provider / factory).
  • Otherwise, the component name (x-component or node key) is looked up in the merged components registry. Merge order: Default (factory) → Global (ScheptaProvider) → Local (factory props). Later overrides earlier.

Props Resolution Order:

  1. Schema-defined props (x-component-props, etc.), with template expressions resolved
  2. Derived props (from schema structure, e.g. field name)
  3. Context (form adapter, externalContext) available to components
  4. Default props (component defaults)

Middleware Resolution Order:

  • Template expression middleware runs first (so {{ $formValues.x }} and {{ $externalContext.x }} are resolved).
  • Then Provider middlewares and factory middlewares run in array order.

Expression Resolution

Template expressions in props are resolved using form values and external context:

Expression TypeResolutionExampleResult
Static valuesDirect"required": truerequired={true}
Form values$formValues"{{ $formValues.email }}"Current form field value
External context$externalContext"{{ $externalContext.user.name }}"Value from Provider externalContext
JEXL expressionsEvaluated"{{ $formValues.age >= 18 }}"boolean

Schema Resolution is the "processor" that connects schemas with React/Vue: