Skip cfg: reference types in DCS valueType to fix XDTO build errors

Real 1C DCS files (12,495 analyzed) never include cfg:CatalogRef.XXX
in <valueType> — the platform infers field types from query metadata.
Emitting them causes XDTO exceptions when building EPF. Reference
types in JSON DSL still set field roles but no longer emit valueType.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-11 11:32:17 +03:00
co-authored by Claude Opus 4.6
parent 91e4e1948f
commit eb6f8379e6
3 changed files with 22 additions and 13 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ powershell.exe -NoProfile -File .claude\skills\skd-compile\scripts\skd-compile.p
"Служебное: string #noFilter #noOrder" — + ограничения
```
Типы: `string`, `string(N)`, `decimal(D,F)`, `boolean`, `date`, `dateTime`, `CatalogRef.X`, `DocumentRef.X`, `EnumRef.X`, `StandardPeriod`.
Типы: `string`, `string(N)`, `decimal(D,F)`, `boolean`, `date`, `dateTime`, `CatalogRef.X`, `DocumentRef.X`, `EnumRef.X`, `StandardPeriod`. Ссылочные типы (`CatalogRef`, `DocumentRef`, `EnumRef`) задают роли полей, но не эмитируются в `<valueType>` — платформа определяет их из запроса.
**Синонимы типов** (русские и альтернативные): `число` = decimal, `строка` = string, `булево` = boolean, `дата` = date, `датаВремя` = dateTime, `СтандартныйПериод` = StandardPeriod, `СправочникСсылка.X` = CatalogRef.X, `ДокументСсылка.X` = DocumentRef.X, `int`/`number` = decimal, `bool` = boolean. Регистронезависимые.
@@ -195,18 +195,25 @@ function Emit-ValueType {
return
}
# cfg: references (CatalogRef.XXX, DocumentRef.XXX, EnumRef.XXX, etc.)
# cfg: references — skip in DCS (platform infers types from query metadata)
# Emitting cfg:CatalogRef.XXX causes XDTO errors; real DCS files never use them
if ($typeStr -match '^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef)\.') {
X "$indent<v8:Type>cfg:$(Esc-Xml $typeStr)</v8:Type>"
return
}
# Fallback
# Fallback — skip dot-qualified types (likely cfg: references)
if ($typeStr.Contains('.')) {
X "$indent<v8:Type>cfg:$(Esc-Xml $typeStr)</v8:Type>"
} else {
X "$indent<v8:Type>$(Esc-Xml $typeStr)</v8:Type>"
return
}
X "$indent<v8:Type>$(Esc-Xml $typeStr)</v8:Type>"
}
function Is-RefType {
param([string]$typeStr)
if (-not $typeStr) { return $false }
$resolved = Resolve-TypeStr $typeStr
return ($resolved -match '^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef)\.' -or ($resolved.Contains('.') -and $resolved -notmatch '^(string|decimal)'))
}
# --- 5. Field shorthand parser ---
@@ -576,8 +583,8 @@ function Emit-Field {
X "$indent`t</role>"
}
# ValueType
if ($f.type) {
# ValueType (skip for cfg: reference types — platform infers from query)
if ($f.type -and -not (Is-RefType $f.type)) {
X "$indent`t<valueType>"
Emit-ValueType -typeStr $f.type -indent "$indent`t`t"
X "$indent`t</valueType>"