mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 09:30:59 +03:00
fix(skd-compile): DataSetUnion inner items оборачиваются как <item>
Платформенный 1С пишет вложенные dataSets внутри DataSetUnion как <item xsi:type="DataSetQuery">, а наш compile эмитил <dataSet xsi:type=...>. Это вело к двум проблемам: - сгенерированный XML отличался от платформенного (косметика для bit-perfect) - skd-decompile симметрично искал <dataSet> и пропускал inner items при чтении реальных схем — теряя все вложенные fields/titles Эталон: upload/erf/ПроверкаЭкранирования/.../Templates/СКД_Объединение показывает что Designer всегда пишет <item xsi:type="..."> внутри Union. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
a46d5a166b
commit
eac0ae5a02
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.38 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.39 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -989,7 +989,7 @@ function Emit-Field {
|
||||
|
||||
# === DataSets ===
|
||||
function Emit-DataSet {
|
||||
param($ds, [string]$indent)
|
||||
param($ds, [string]$indent, [string]$tagName = "dataSet")
|
||||
|
||||
# Determine type
|
||||
if ($ds.items) {
|
||||
@@ -1000,7 +1000,7 @@ function Emit-DataSet {
|
||||
$dsType = "DataSetQuery"
|
||||
}
|
||||
|
||||
X "$indent<dataSet xsi:type=`"$dsType`">"
|
||||
X "$indent<$tagName xsi:type=`"$dsType`">"
|
||||
X "$indent`t<name>$(Esc-Xml "$($ds.name)")</name>"
|
||||
|
||||
# Fields
|
||||
@@ -1027,12 +1027,12 @@ function Emit-DataSet {
|
||||
X "$indent`t<objectName>$(Esc-Xml "$($ds.objectName)")</objectName>"
|
||||
} elseif ($dsType -eq "DataSetUnion") {
|
||||
foreach ($item in $ds.items) {
|
||||
# Union items are nested dataSets
|
||||
Emit-DataSet -ds $item -indent "$indent`t" | Out-Null
|
||||
# Union inner items are wrapped as <item xsi:type="...">
|
||||
Emit-DataSet -ds $item -indent "$indent`t" -tagName "item" | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
X "$indent</dataSet>"
|
||||
X "$indent</$tagName>"
|
||||
}
|
||||
|
||||
function Emit-DataSets {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.38 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.39 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -759,7 +759,7 @@ def emit_field(lines, field_def, indent):
|
||||
|
||||
# === DataSets ===
|
||||
|
||||
def emit_data_set(lines, ds, indent, default_source):
|
||||
def emit_data_set(lines, ds, indent, default_source, tag_name='dataSet'):
|
||||
# Determine type
|
||||
if ds.get('items'):
|
||||
ds_type = 'DataSetUnion'
|
||||
@@ -768,7 +768,7 @@ def emit_data_set(lines, ds, indent, default_source):
|
||||
else:
|
||||
ds_type = 'DataSetQuery'
|
||||
|
||||
lines.append(f'{indent}<dataSet xsi:type="{ds_type}">')
|
||||
lines.append(f'{indent}<{tag_name} xsi:type="{ds_type}">')
|
||||
lines.append(f'{indent}\t<name>{esc_xml(str(ds.get("name", "")))}</name>')
|
||||
|
||||
# Fields
|
||||
@@ -791,9 +791,10 @@ def emit_data_set(lines, ds, indent, default_source):
|
||||
lines.append(f'{indent}\t<objectName>{esc_xml(str(ds["objectName"]))}</objectName>')
|
||||
elif ds_type == 'DataSetUnion':
|
||||
for item in ds['items']:
|
||||
emit_data_set(lines, item, f'{indent}\t', default_source)
|
||||
# Union inner items are wrapped as <item xsi:type="...">
|
||||
emit_data_set(lines, item, f'{indent}\t', default_source, tag_name='item')
|
||||
|
||||
lines.append(f'{indent}</dataSet>')
|
||||
lines.append(f'{indent}</{tag_name}>')
|
||||
|
||||
|
||||
def emit_data_sets(lines, defn, default_source):
|
||||
|
||||
Reference in New Issue
Block a user