Skip to content

VIEW021: invalid-view-structure

A part of a view or of the session properties has the wrong JSON type

Code VIEW021
Name invalid-view-structure
Category View structure (VIEW)
Default severity error
Enabled by default yes
Fix available no
ign-lint equivalent none

Reports the parts of a view.json (and of the session properties' props.json) that iglint reads and that have the wrong JSON type: a root or child component that is not an object, children that is not an array, events, scripts or propConfig that is not an object, an event action, binding, change script, message handler, custom method or extension function that is not an object, a script or a name that is not a string, a component without meta.name. Each problem is reported once, at the offending value.

Perspective cannot load such a part as written: the component, event or script is dropped or the view fails to open, usually without a message in the Designer. iglint skips the broken part too, so no other rule checks what is inside it. When the broken part may hold scripts (it is a component, an event, a script place or a script and contains text), the code there is unknown to iglint: safe fixes that rely on knowing every script of the workspace (SCR102, VIEW015, NAME001) become unsafe and name it.

{
"root": {
"type": "ia.container.flex",
"meta": {"name": "root"},
"children": "Label",
"scripts": {"customMethods": [{"name": 5, "script": "\treturn 1"}]}
}
}

Use instead:

{
"root": {
"type": "ia.container.flex",
"meta": {"name": "root"},
"children": [{"type": "ia.display.label", "meta": {"name": "Label"}}],
"scripts": {"customMethods": [{"name": "answer", "params": [], "script": "\treturn 1"}]}
}
}

Generated from the rule metadata by iglint generate-docs; iglint rule VIEW021 prints the same page in the terminal. Source: docs/rules/VIEW021.md.