mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-14 18:04:58 +03:00
Fix reference types to use d5p1: namespace instead of cfg:
Real DCS files use inline xmlns:d5p1="http://v8.1c.ru/8.1/data/ enterprise/current-config" for reference types like CatalogRef.XXX. Using cfg: prefix caused XDTO errors because the namespace was undeclared. With correct d5p1: namespace, EPF builds successfully in both empty and config-aware bases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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`. Ссылочные типы (`CatalogRef`, `DocumentRef`, `EnumRef`) задают роли полей, но не эмитируются в `<valueType>` — платформа определяет их из запроса.
|
||||
Типы: `string`, `string(N)`, `decimal(D,F)`, `boolean`, `date`, `dateTime`, `CatalogRef.X`, `DocumentRef.X`, `EnumRef.X`, `StandardPeriod`. Ссылочные типы эмитируются с inline namespace `d5p1:` (`http://v8.1c.ru/8.1/data/enterprise/current-config`). Сборка EPF со ссылочными типами требует базу с соответствующей конфигурацией.
|
||||
|
||||
**Синонимы типов** (русские и альтернативные): `число` = decimal, `строка` = string, `булево` = boolean, `дата` = date, `датаВремя` = dateTime, `СтандартныйПериод` = StandardPeriod, `СправочникСсылка.X` = CatalogRef.X, `ДокументСсылка.X` = DocumentRef.X, `int`/`number` = decimal, `bool` = boolean. Регистронезависимые.
|
||||
|
||||
|
||||
@@ -195,27 +195,22 @@ function Emit-ValueType {
|
||||
return
|
||||
}
|
||||
|
||||
# cfg: references — skip in DCS (platform infers types from query metadata)
|
||||
# Emitting cfg:CatalogRef.XXX causes XDTO errors; real DCS files never use them
|
||||
# Reference types: CatalogRef.XXX, DocumentRef.XXX, EnumRef.XXX, etc.
|
||||
# Real DCS files use inline namespace d5p1="http://v8.1c.ru/8.1/data/enterprise/current-config"
|
||||
if ($typeStr -match '^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef)\.') {
|
||||
X "$indent<v8:Type xmlns:d5p1=`"http://v8.1c.ru/8.1/data/enterprise/current-config`">d5p1:$(Esc-Xml $typeStr)</v8:Type>"
|
||||
return
|
||||
}
|
||||
|
||||
# Fallback — skip dot-qualified types (likely cfg: references)
|
||||
# Fallback — assume dot-qualified types are also config references
|
||||
if ($typeStr.Contains('.')) {
|
||||
X "$indent<v8:Type xmlns:d5p1=`"http://v8.1c.ru/8.1/data/enterprise/current-config`">d5p1:$(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 ---
|
||||
|
||||
function Parse-FieldShorthand {
|
||||
@@ -583,8 +578,8 @@ function Emit-Field {
|
||||
X "$indent`t</role>"
|
||||
}
|
||||
|
||||
# ValueType (skip for cfg: reference types — platform infers from query)
|
||||
if ($f.type -and -not (Is-RefType $f.type)) {
|
||||
# ValueType
|
||||
if ($f.type) {
|
||||
X "$indent`t<valueType>"
|
||||
Emit-ValueType -typeStr $f.type -indent "$indent`t`t"
|
||||
X "$indent`t</valueType>"
|
||||
|
||||
@@ -147,13 +147,13 @@
|
||||
| `boolean` | `xs:boolean` | — |
|
||||
| `date` | `xs:dateTime` | DateFractions=Date |
|
||||
| `dateTime` | `xs:dateTime` | DateFractions=DateTime |
|
||||
| `CatalogRef.XXX` | *(не эмитируется)* | Роль поля сохраняется, `<valueType>` опускается |
|
||||
| `DocumentRef.XXX` | *(не эмитируется)* | Платформа определяет тип из запроса |
|
||||
| `EnumRef.XXX` | *(не эмитируется)* | |
|
||||
| `ChartOfAccountsRef.XXX` | *(не эмитируется)* | |
|
||||
| `CatalogRef.XXX` | `d5p1:CatalogRef.XXX` | inline xmlns:d5p1 |
|
||||
| `DocumentRef.XXX` | `d5p1:DocumentRef.XXX` | inline xmlns:d5p1 |
|
||||
| `EnumRef.XXX` | `d5p1:EnumRef.XXX` | inline xmlns:d5p1 |
|
||||
| `ChartOfAccountsRef.XXX` | `d5p1:ChartOfAccountsRef.XXX` | inline xmlns:d5p1 |
|
||||
| `StandardPeriod` | `v8:StandardPeriod` | — |
|
||||
|
||||
> **Ссылочные типы** (`CatalogRef.XXX`, `DocumentRef.XXX` и др.) указываются в JSON для задания ролей полей (`@dimension`, `@account` и т.д.), но **не эмитируются** в `<valueType>`. Реальные DCS-файлы 1С не содержат `cfg:` ссылок в valueType — платформа определяет типы полей автоматически из метаданных запроса. Включение `cfg:` типов приводит к ошибке XDTO при загрузке.
|
||||
> **Ссылочные типы** (`CatalogRef.XXX`, `DocumentRef.XXX` и др.) эмитируются с inline namespace declaration: `<v8:Type xmlns:d5p1="http://v8.1c.ru/8.1/data/enterprise/current-config">d5p1:CatalogRef.XXX</v8:Type>`. Использование префикса `cfg:` вместо `d5p1:` с объявлением namespace приводит к ошибке XDTO. Сборка EPF со ссылочными типами требует базу с соответствующей конфигурацией (не пустую).
|
||||
|
||||
### Синонимы типов
|
||||
|
||||
|
||||
Reference in New Issue
Block a user