mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-01 17:27:45 +03:00
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:
co-authored by
Claude Opus 4.6
parent
0b2c09f8d9
commit
e3069ceb36
@@ -1,4 +1,4 @@
|
||||
# form-compile v1.3 — Compile 1C managed form from JSON
|
||||
# form-compile v1.4 — Compile 1C managed form from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -260,14 +260,12 @@ function Emit-SingleType {
|
||||
|
||||
# Fallback with validation
|
||||
if ($script:knownInvalidTypes.ContainsKey($typeStr)) {
|
||||
Write-Warning "Type '$typeStr': $($script:knownInvalidTypes[$typeStr])"
|
||||
throw "Invalid form attribute type '$typeStr': $($script:knownInvalidTypes[$typeStr])"
|
||||
}
|
||||
if ($typeStr.Contains('.')) {
|
||||
X "$indent<v8:Type>cfg:$typeStr</v8:Type>"
|
||||
} else {
|
||||
if (-not $script:knownInvalidTypes.ContainsKey($typeStr)) {
|
||||
Write-Warning "Unrecognized bare type '$typeStr' — will be emitted without namespace prefix"
|
||||
}
|
||||
Write-Warning "Unrecognized bare type '$typeStr' — will be emitted without namespace prefix"
|
||||
X "$indent<v8:Type>$typeStr</v8:Type>"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# form-compile v1.2 — Compile 1C managed form from JSON
|
||||
# form-compile v1.4 — Compile 1C managed form from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -330,12 +330,11 @@ def emit_single_type(lines, type_str, indent):
|
||||
|
||||
# Fallback with validation
|
||||
if type_str in KNOWN_INVALID_TYPES:
|
||||
print(f"WARNING: Type '{type_str}': {KNOWN_INVALID_TYPES[type_str]}", file=sys.stderr)
|
||||
raise ValueError(f"Invalid form attribute type '{type_str}': {KNOWN_INVALID_TYPES[type_str]}")
|
||||
if '.' in type_str:
|
||||
lines.append(f'{indent}<v8:Type>cfg:{type_str}</v8:Type>')
|
||||
else:
|
||||
if type_str not in KNOWN_INVALID_TYPES:
|
||||
print(f"WARNING: Unrecognized bare type '{type_str}' — will be emitted without namespace prefix", file=sys.stderr)
|
||||
print(f"WARNING: Unrecognized bare type '{type_str}' — will be emitted without namespace prefix", file=sys.stderr)
|
||||
lines.append(f'{indent}<v8:Type>{type_str}</v8:Type>')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user