From 2ad35f484c13d8390911b803a147da59a3834ae9 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Sun, 24 May 2026 15:56:28 +0300 Subject: [PATCH] =?UTF-8?q?fix(skd):=20empty=20xs:string=20placeholder=20?= =?UTF-8?q?=D0=B2=20SettingsParameterValue=20use=3Dfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Параметр типа DateTime в dataParameters внутри settings с use=false и без значения сохраняется оригиналом как (пустой placeholder), а не xsi:nil. См. АнализПлановыхНачислений @1506 для ОкончаниеПериода. decompile: detect-ит empty xs:string + use=false → object form {parameter, use:false, value:'', valueType:'xs:string'}. compile: Emit-EmptyValue нормализует префикс xs: (xs:string → ^string), теперь корректно эмитит пустой xs:string вместо fallback xsi:nil. PS и Py синхронизированы. --- .claude/skills/skd-compile/scripts/skd-compile.ps1 | 12 +++++++----- .claude/skills/skd-compile/scripts/skd-compile.py | 12 +++++++----- .../skills/skd-decompile/scripts/skd-decompile.ps1 | 13 +++++++++++-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index c25cdf5d..2045541e 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.ps1 +++ b/.claude/skills/skd-compile/scripts/skd-compile.ps1 @@ -1,4 +1,4 @@ -# skd-compile v1.87 — Compile 1C DCS from JSON +# skd-compile v1.88 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -1468,6 +1468,8 @@ function Emit-EmptyValue { if ($valueListAllowed) { return } $t = if ($null -eq $type) { "" } else { "$type" } + # Нормализация: убираем префикс xs: (валидный для valueType из decompile/DSL) + $tBare = if ($t -match '^xs:(.+)$') { $matches[1] } else { $t } $pf = $tagPrefix if ($t -eq "") { @@ -1478,13 +1480,13 @@ function Emit-EmptyValue { X "$indent`t0001-01-01T00:00:00" X "$indent`t0001-01-01T00:00:00" X "$indent" - } elseif ($t -match '^string') { + } elseif ($tBare -match '^string') { X "$indent<${pf}value xsi:type=`"xs:string`"/>" - } elseif ($t -match '^(date|time)') { + } elseif ($tBare -match '^(date|time)') { X "$indent<${pf}value xsi:type=`"xs:dateTime`">0001-01-01T00:00:00" - } elseif ($t -match '^decimal') { + } elseif ($tBare -match '^decimal') { X "$indent<${pf}value xsi:type=`"xs:decimal`">0" - } elseif ($t -eq "boolean") { + } elseif ($tBare -eq "boolean") { X "$indent<${pf}value xsi:type=`"xs:boolean`">false" } else { # Ref types or unknown — safe nil diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index b8f5ea43..2789582a 100644 --- a/.claude/skills/skd-compile/scripts/skd-compile.py +++ b/.claude/skills/skd-compile/scripts/skd-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# skd-compile v1.87 — Compile 1C DCS from JSON +# skd-compile v1.88 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -1010,6 +1010,8 @@ def emit_empty_value(lines, type_str, indent, tag_prefix='', value_list_allowed= if value_list_allowed: return t = type_str or '' + # Нормализация: убираем префикс xs: (валидный для valueType из decompile/DSL) + t_bare = t[3:] if t.startswith('xs:') else t pf = tag_prefix if t == '': @@ -1020,13 +1022,13 @@ def emit_empty_value(lines, type_str, indent, tag_prefix='', value_list_allowed= lines.append(f'{indent}\t0001-01-01T00:00:00') lines.append(f'{indent}\t0001-01-01T00:00:00') lines.append(f'{indent}') - elif re.match(r'^string', t): + elif re.match(r'^string', t_bare): lines.append(f'{indent}<{pf}value xsi:type="xs:string"/>') - elif re.match(r'^(date|time)', t): + elif re.match(r'^(date|time)', t_bare): lines.append(f'{indent}<{pf}value xsi:type="xs:dateTime">0001-01-01T00:00:00') - elif re.match(r'^decimal', t): + elif re.match(r'^decimal', t_bare): lines.append(f'{indent}<{pf}value xsi:type="xs:decimal">0') - elif t == 'boolean': + elif t_bare == 'boolean': lines.append(f'{indent}<{pf}value xsi:type="xs:boolean">false') else: # Ref types or unknown — safe nil diff --git a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 index 396e5bc6..4d94673f 100644 --- a/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 +++ b/.claude/skills/skd-decompile/scripts/skd-decompile.ps1 @@ -1868,12 +1868,21 @@ function Build-DataParameters { # Compare to top-level default if ($tp -and $tp.valueDisplay -ne $vDisplay) { $canAuto = $false } if (-not $tp) { $canAuto = $false } # extra param not in top-level - # Object form требуется если есть viewMode / userSettingPresentation / StandardPeriod-с-датами - if ($stdPeriodObj -or $vmN -or $uspN) { + # Empty xs:string + use=false — оригинальный placeholder для disabled-параметра + # (используется для типа DateTime в settings; см. АнализПлановыхНачислений @1506). + # Сохраняем явный valueType чтобы compile эмитил + # вместо xsi:nil. + $isEmptyStringPlaceholder = ($vt -eq 'string') -and (-not $valNode.InnerText) -and ($use -eq 'false') + if ($isEmptyStringPlaceholder) { $canAuto = $false } + # Object form требуется если есть viewMode / userSettingPresentation / StandardPeriod-с-датами / xs:string-placeholder + if ($stdPeriodObj -or $vmN -or $uspN -or $isEmptyStringPlaceholder) { $obj = [ordered]@{ parameter = $pn } if ($stdPeriodObj) { $obj['value'] = $stdPeriodObj # valueType не нужен — compile определит StandardPeriod по value.variant + } elseif ($isEmptyStringPlaceholder) { + $obj['value'] = '' + $obj['valueType'] = 'xs:string' } elseif ($null -ne $vDisplay -and $vDisplay -ne '') { # Конвертация для типизированных значений (compile различает по типу JSON) if ($vt -eq 'boolean') { $obj['value'] = ($vDisplay -eq 'true') }