Mutator Spec
Define how create, update, and delete operations should behave via declarative specs.
A Mutator Spec defines how a record can be created, updated, or deleted. It represents a form-based mutation layer on top of your model—complete with fields, validations, generators, and layout.
🧩 Basic Structure
⚙️ Required Fields
| Field | Type | Description |
|---|---|---|
name | string | Unique identifier for the mutator |
type | "mutator" | Must always be "mutator" |
label | string | Human-readable label |
dbOp | string | The operation: create, update, delete |
model | string | Associated model name |
attributes | object | Attribute definitions (subset or full model) |
✏️ attributes
Each attribute you define in the mutator can contain:
type: data type (same as model types)label: display labelgenerations: how to auto-generate valuesvalidations: field-level validation rules
🧱 schema and uiSchema
The schema and uiSchema are optional and renderer-specific. They follow the JSON Schema + JSONForms format and allow you to define and control the form layout and behavior at a presentation level.
These keys do not impact API behavior—they exist purely to help UI builders render meaningful, structured forms.
schema
Describes the structure of the form data using JSON Schema.
uiSchema
Controls how fields are laid out and rendered.
Supported UI Elements
| Type | Description |
|---|---|
Control | Standard form field |
lens-text-input | Custom text input |
lens-dropdown | Custom dropdown for options |
lens-calendar | Date picker |
lens-switch | Boolean toggle |
VerticalLayout | Stack elements vertically |
HorizontalLayout | Arrange elements side-by-side |
Group | Group of elements with a label |
🔧 You can combine
schema+uiSchemafor custom layouts and keepattributesfocused only on API-level validation and generation.
🔁 dbOp
Supported database operations:
"create"— create a new row"update"— update an existing row"delete"— mark or remove a row
ℹ️ Use
generationsandvalidationsto control how fields behave on a per-operation basis.