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 Schema from backendResolution + ValidationReact/Vue Element TreeRendered interface
Component specsRegistry lookupComponent instancesWorking components
Props and contextMiddleware pipelineEnhanced propsCorrect behavior

📊 Resolution Flow:

Automatic Steps:

  1. Schema Parsing: JSON → Internal structure
  2. Component Lookup: x-component → React/Vue Component
  3. Props Resolution: Schema properties → Component props
  4. Context Injection: Form/Menu context → Component context
  5. Middleware Application: Props transformation pipeline
  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

Different schema types require different resolution strategies:

📝 Form Schema Resolution:

Schema PropertyResolution StrategyReact/Vue ResultExample
nameField identificationname prop<input name="email" />
x-componentComponent registry lookupComponent type<InputText />
requiredValidation rulerequired prop + validationrequired={true}
x-component-propsProps passthroughDirect propsplaceholder="Enter email"
x-rulesValidation configurationValidation propspattern="email"

🧭 Menu Schema Resolution:

Schema PropertyResolution StrategyReact/Vue ResultExample
labelText contentchildren prop<MenuItem>Dashboard</MenuItem>
urlNavigation targethref or onClick<Link to="/dashboard" />
iconIcon componentIcon element<DashboardIcon />
visibleConditional renderingConditional wrapper{visible && <MenuItem />}
childrenNested menu itemsRecursive resolution<Submenu items={...} />

🎨 Component Schema Resolution:

Schema PropertyResolution StrategyReact/Vue ResultExample
x-componentComponent type lookupComponent class<Button />
x-uiLayout/styling propsCSS/styling propsclassName="col-md-6"
x-component-propsComponent-specific propsProps object{ variant: "primary" }
x-reactionsEvent handlersEvent propsonClick={handleClick}

⚙️ Resolution Engine

How the system resolves schemas internally:

🔄 Resolution Pipeline:

Raw JSON Schema

Validate Schema (Valid JSON?)

Resolve Component (Registry lookup)

Map Props (Schema → Component props)

Inject Context (Form/Menu/Global context)

Apply Middleware (Transformations pipeline)

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

Final React/Vue Element

🎯 Resolution Priorities:

Component Resolution Order:

  1. Local components (factory props)
  2. Global components (scheptaProvider)
  3. Registry overrides (registerComponent calls)
  4. Default components (built-in registry)

Props Resolution Order:

  1. Schema-defined props (x-component-props)
  2. Derived props (from schema structure)
  3. Context props (form context, etc.)
  4. Default props (component defaults)

Middleware Resolution Order:

  1. Built-in middleware (validation, formatting)
  2. Global middleware (scheptaProvider)
  3. Local middleware (factory props)
  4. Component middleware (component-specific)

📊 Resolution Strategies

Different strategies for different content types:

🎯 Expression Resolution:

Expression TypeResolution StrategyExampleResult
Static ValuesDirect assignment"required": truerequired={true}
Segment ExpressionsContext substitution"\{\{ $segment.tenant \}\}""bank 1"
Association ExpressionsAssociation lookup"\{\{ $target.title \}\}""Portal Title"
JEXL ExpressionsExpression evaluation"\{\{ $segment.role === 'admin' \}\}"true

🔧 Conditional Resolution:

Visibility Resolution:

typescript
const visible = evaluateExpression(schema.visible, context);
if (!visible) return null; // Component doesn't render

Dynamic Props Resolution:

typescript
const dynamicProps = schema['x-component-props'];
const resolvedProps = resolveDynamicValues(dynamicProps, context);

Validation Resolution:

  • Rules → Props: x-rules transformed into validation properties
  • Context Injection: Form context automatically injected for validation
  • Error Handling: Fallbacks for invalid or malformed rules

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