fix(form-compile): throw on known invalid attribute types

KNOWN_INVALID_TYPES (FormDataStructure, FormDataCollection, FormDataTree,
etc.) was checked but only produced a Write-Warning/print warning — the
script still emitted the bad <v8:Type> into Form.xml, which XDTO later
rejected with a cryptic load-time error. Turn the warning into a hard
throw so misuse is caught at compile time with the correct hint.

Reveals two broken test cases that shipped invalid forms:
- form-compile/catalog-form: main attribute was FormDataStructure, fixed
  to CatalogObject.Товары (what ERP's reference catalog forms actually
  use with the cfg: prefix).
- form-info/overview: preRun form-compile used the same wrong type, fixed
  the same way; snapshot regenerated.

Bumps form-compile to v1.4 on both runtimes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-04-11 22:03:24 +03:00
parent 0b2c09f8d9
commit e3069ceb36
6 changed files with 10 additions and 13 deletions
@@ -16,7 +16,7 @@
"input": {
"title": "Товар",
"attributes": [
{ "name": "Объект", "type": "FormDataStructure", "main": true }
{ "name": "Объект", "type": "CatalogObject.Товары", "main": true }
],
"elements": [
{ "input": "Наименование", "path": "Объект.Наименование", "title": "Наименование" },
@@ -37,7 +37,7 @@
<Attributes>
<Attribute name="Объект" id="7">
<Type>
<v8:Type>FormDataStructure</v8:Type>
<v8:Type>cfg:CatalogObject.Товары</v8:Type>
</Type>
<MainAttribute>true</MainAttribute>
</Attribute>
+1 -1
View File
@@ -12,7 +12,7 @@
},
{
"script": "form-compile/scripts/form-compile",
"input": { "title": "Тест", "attributes": [{ "name": "Объект", "type": "FormDataStructure", "main": true }], "elements": [{ "type": "InputField", "dataPath": "Объект.Наименование" }] },
"input": { "title": "Тест", "attributes": [{ "name": "Объект", "type": "CatalogObject.Товары", "main": true }], "elements": [{ "type": "InputField", "dataPath": "Объект.Наименование" }] },
"args": { "-JsonPath": "{inputFile}", "-OutputPath": "{workDir}/Catalogs/Товары/Forms/Форма/Ext/Form.xml" }
}
],
@@ -15,7 +15,7 @@
<Attributes>
<Attribute name="Объект" id="1">
<Type>
<v8:Type>FormDataStructure</v8:Type>
<v8:Type>cfg:CatalogObject.Товары</v8:Type>
</Type>
<MainAttribute>true</MainAttribute>
</Attribute>