Files
metabuilder/codegen/JSON_EXPRESSION_SYSTEM.md
johndoe6345789 a51130a127 feat: Add external low-code and postgres repositories
- codegen: Low-code React app with JSON-driven component system
- packagerepo: Schema-driven package repository with backend/frontend
- postgres: Next.js app with Drizzle ORM and PostgreSQL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 16:48:52 +00:00

63 lines
1.4 KiB
Markdown

# JSON Expression System
This document describes the supported JSON expression patterns used across JSON UI schemas.
Legacy compute functions have been removed in favor of expression strings and value templates.
## Core Concepts
### Expressions
Expressions are string values that resolve against a data + event context:
```json
{
"expression": "event.target.value"
}
```
Supported expression patterns:
- `data` or `event`
- Dot access: `data.user.name`, `event.target.value`
- Literals: numbers, booleans, `null`, `undefined`, quoted strings
- Time: `Date.now()`
- Array filtering:
- `data.todos.filter(completed === true)`
- `data.users.filter(status === 'active').length`
### Value Templates
Value templates are JSON objects whose string values are evaluated as expressions:
```json
{
"valueTemplate": {
"id": "Date.now()",
"text": "data.newTodo",
"completed": false
}
}
```
### Conditions
Conditions use expression strings that are evaluated against the data context:
```json
{
"condition": "data.newTodo.length > 0"
}
```
Supported condition patterns:
- `data.field > 0`
- `data.field.length > 0`
- `data.field === 'value'`
- `data.field != null`
## Legacy Compute Functions (Removed)
Schemas should no longer reference function names in `compute`, `transform`, or string-based
condition fields. Use `expression` and `valueTemplate` instead.