AI: Common mistakes and anti-patterns
This page exists so that the agent does not keep repeating the same mistakes when generating NGX View Builder JSON.
1. Wrong element selection
Mistake
The user asks for a "dynamic table" and the agent generates table.
What to do correctly
- Use
dynamicTablefor editable rows withadd rowanddelete row. - Use
tablefor server-side data grid scenarios.
2. Self-reference expression
Mistake
{
"name": "lastName",
"expression": "{firstName} == 'John' ? 'Doe' : {lastName}"
}Problem
- the element references itself
- the logic may not work or may behave unpredictably
Correct
{
"name": "lastName",
"expression": "{firstName} == 'John' ? 'Doe' : ''",
"logicExecutionMode": "onChange"
}3. Mixing pages and elements
Mistake
- the agent places a full element object directly in
pages.rows.columns
Correct
pagesholds only layoutcolumns[*].elementRefpoints toelements
4. Missing page entry in the elements map
Mistake
Present:
{
"pages": [{ "name": "page1", "rows": [] }]
}but missing:
{
"elements": {
"page1": {
"name": "page1",
"type": "page",
"label": "Page 1"
}
}
}5. Generating non-existent properties
Mistake
- the agent invents custom properties that NGX View Builder does not have
Rule
- if you cannot find a property in the documentation or catalog, do not use it
6. Too much metadata
Mistake
- unnecessary
settingsor extra wrappers are added
Rule
- keep only properties that are actually used
- if a feature is not active, it is better to omit its child properties
7. Wrong value shape
Typical mistakes:
dateRangereturns a string instead of{ dateFrom, dateTo }multiSelectreturns a single value instead of an arraysingleCheckboxreturns a string instead ofbooleandynamicPanelordynamicTabledoes not return an array
8. Logic without onChange when recalculation is needed
Symptom
- the form renders, but the interdependency logic does not work as expected
Why
- the correct logic execution mode is missing
Rule
- if one field's value must immediately affect another field,
logicExecutionMode: "onChange"is often required
9. Overly aggressive rewrite of an existing form
Mistake
- the user asks to add one field, and the agent rebuilds the entire form from scratch
Rule
- in extension mode, change only what is relevant to the task
- do not remove
dataSources,localization,settings, or other sections without reason
10. Broken datasource references
Mistake
- an element references
dataSourceNamebut no such datasource exists - a datasource exists but the item path or value/label mapping is wrong
Rule
- every datasource reference must point to a real, documented object
11. Using name instead of key in table columns
Mistake
{
"type": "table",
"columnsConfig": [
{
"name": "firstName",
"label": "First Name",
"type": "text"
}
]
}Problem
tablerenders columns bycolumnsConfig[*].key- if only
nameis present, the column may not be rendered at all
Correct
{
"type": "table",
"columnsConfig": [
{
"key": "firstName",
"label": "First Name",
"type": "text",
"showInTable": true
}
]
}12. Custom frontend instead of NGX View Builder
Mistake
- the agent starts suggesting
Angularcomponents, custom templates, or an API layer, even though an NGX View Builder form was requested
Rule
- the first choice is always the built-in NGX View Builder JSON model
13. Prose instead of JSON
Mistake
- the user asks to generate a form, and the agent writes an explanation followed by JSON
Rule
- in generation mode, return only JSON
14. Wrong element type casing
Mistake
{ "type": "datePicker" }
{ "type": "SingleCheckbox" }
{ "type": "DynamicTable" }
{ "type": "richtext" }
{ "type": "fileupload" }Rule
Type strings are exact lowercase camelCase. The canonical list:
text | textarea | number | slider | phoneInput | code | fileUpload | button | numberStepper | signaturePad
select | multiSelect | radio | checkbox | singleCheckbox | toggleSwitch | toggleButton | dropdown | autocomplete | selectButton | listBox
datepicker | dateRange | timePicker
panel | dynamicPanel | tabs | tabsPro | accordion | dialog | splitter | progressFlow | emptyBlock
dynamicTable | table | listGrid | chart
richText | richTextViewer | customHtml | htmlSnippet | image | video | iframe | avatar | icon
divider | spacer | breadcrumbs | pageTitle | badge | messageCard | statsCard | toast | progressBar
pageNever invent capitalization variants. Copy from the list above.
15. Wrong validator field names
Mistake
{
"validators": [
{
"type": "minLength",
"expression": "{firstName}.length > 0",
"message": "Required"
}
]
}Problem
expressiondoes not exist onIValidatorvisibleIfdoes not exist onIValidator
Correct validator schema
{
"validators": [
{
"type": "minLength",
"value": 3,
"message": "Minimum 3 characters",
"applyIf": "{otherField} != ''"
},
{
"type": "custom",
"condition": "dateDiffDays({startDate}, {endDate}) < 1",
"message": "End date must be after start date"
}
]
}Exact fields allowed on a validator:
type— validator type string (required)value— threshold value when applicable (number | string)message— error message shown to usercondition— JEXL expression; the failing check — when it evaluates totruethe validator error is shownapplyIf— JEXL expression; validator runs only when this is truthy
Never use expression, visibleIf, disableIf, or any other logic field on a validator object.
16. Using logic field names that belong to elements on validators
Mistake
Copying visibleIf, requireIf, readonlyIf, disableIf, expression, resetIf from element-level logic into a validator object. Those fields do not exist on IValidator.
Rule
Element-level logic (visibleIf, disableIf, requireIf, readonlyIf, resetIf, expression) belongs directly on the element, not inside the validators array.
{
"name": "birthDate",
"type": "datepicker",
"requireIf": "{needsBirthDate} == true",
"validators": [
{
"type": "maxDate",
"value": "today",
"message": "Cannot be in the future"
}
]
}17. Wrapping logic fields in a logic object
Mistake
{
"name": "totalAmount",
"type": "number",
"logic": {
"expression": "{price} * {qty}",
"logicExecutionMode": "onChange"
}
}Problem
- There is no
logickey in the NGX View Builder element schema. - The renderer ignores the
logicwrapper — the expression will never execute.
Correct
Logic fields are direct element-level properties — never nested:
{
"name": "totalAmount",
"type": "number",
"expression": "{price} * {qty}",
"logicExecutionMode": "onChange"
}The same rule applies to visibleIf, disableIf, requireIf, readonlyIf, and resetIf.
Final anti-pattern checklist
Before returning a response, the agent must verify:
- Is the correct element chosen.
- Are
pagesandelementsnot mixed up. - Do all
elementRefvalues point to valid entries. - Is there no self-reference expression.
- Is the value shape correct.
- Are there no invented properties.
- Do
table.columnsConfig[*]entries usekey, notname. - Is the existing form context preserved.
- Are logic fields (
expression,visibleIf,disableIf,requireIf,readonlyIf,resetIf,logicExecutionMode) placed directly on the element — not inside alogicwrapper.
