From 1b46eb4d8580e936ef6f8b1f523800b93df27ae7 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Thu, 16 Apr 2026 20:37:00 +0300 Subject: [PATCH] =?UTF-8?q?feat(skd-compile):=20parameters=20=E2=80=94=20t?= =?UTF-8?q?itle=20=D0=B8=20presentation=20=D0=BA=D0=B0=D0=BA=20=D1=81?= =?UTF-8?q?=D0=B8=D0=BD=D0=BE=D0=BD=D0=B8=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - parameter принимает presentation как синоним title (1C UI показывает подпись параметра как "Представление" — модель по аналогии пишет presentation) - availableValues[] принимает title как синоним presentation (обратная ошибка: модель пишет title по аналогии с самим параметром) Обе формы пишутся в один и тот же XML-узел. Версии: skd-compile v1.13 → v1.14. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../skd-compile/scripts/skd-compile.ps1 | 13 ++- .../skills/skd-compile/scripts/skd-compile.py | 13 ++- ...parameter-title-presentation-synonyms.json | 27 ++++++ .../Template.xml | 83 +++++++++++++++++++ 4 files changed, 128 insertions(+), 8 deletions(-) create mode 100644 tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json create mode 100644 tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml diff --git a/.claude/skills/skd-compile/scripts/skd-compile.ps1 b/.claude/skills/skd-compile/scripts/skd-compile.ps1 index f1201d0b..37ed248e 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.13 — Compile 1C DCS from JSON +# skd-compile v1.14 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [string]$DefinitionFile, @@ -931,12 +931,15 @@ function Emit-SingleParam { X "`t" X "`t`t$(Esc-Xml $parsed.name)" - # Title (from parsed first, then from object form) + # Title (from parsed first, then from object form; accept `presentation` as + # a synonym — 1C UI labels a parameter's caption "Представление"). $title = "" if ($parsed.title) { $title = "$($parsed.title)" } elseif ($p -isnot [string] -and $p.title) { $title = "$($p.title)" + } elseif ($p -isnot [string] -and $p.presentation) { + $title = "$($p.presentation)" } if ($title) { Emit-MLText -tag "title" -text $title -indent "`t`t" @@ -988,11 +991,13 @@ function Emit-SingleParam { } X "`t`t" X "`t`t`t$(Esc-Xml $avVal)" - if ($av.presentation) { + # `title` accepted as synonym of `presentation` — both map to the same UI label. + $avPres = if ($av.presentation) { "$($av.presentation)" } elseif ($av.title) { "$($av.title)" } else { "" } + if ($avPres) { X "`t`t`t" X "`t`t`t`t" X "`t`t`t`t`tru" - X "`t`t`t`t`t$(Esc-Xml "$($av.presentation)")" + X "`t`t`t`t`t$(Esc-Xml $avPres)" X "`t`t`t`t" X "`t`t`t" } diff --git a/.claude/skills/skd-compile/scripts/skd-compile.py b/.claude/skills/skd-compile/scripts/skd-compile.py index 3d9add72..26d2cf68 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.13 — Compile 1C DCS from JSON +# skd-compile v1.14 — Compile 1C DCS from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json @@ -802,12 +802,15 @@ def emit_single_param(lines, p, parsed): lines.append('\t') lines.append(f'\t\t{esc_xml(parsed["name"])}') - # Title (from parsed first, then from object form) + # Title (from parsed first, then from object form; accept `presentation` as + # a synonym — 1C UI labels a parameter's caption "Представление"). title = '' if parsed.get('title'): title = str(parsed['title']) elif p is not None and not isinstance(p, str) and p.get('title'): title = str(p['title']) + elif p is not None and not isinstance(p, str) and p.get('presentation'): + title = str(p['presentation']) if title: emit_mltext(lines, '\t\t', 'title', title) @@ -852,11 +855,13 @@ def emit_single_param(lines, p, parsed): av_type = 'dcscor:DesignTimeValue' lines.append('\t\t') lines.append(f'\t\t\t{esc_xml(av_val)}') - if av.get('presentation'): + # `title` accepted as synonym of `presentation` — both map to the same UI label. + av_pres = str(av.get('presentation') or av.get('title') or '') + if av_pres: lines.append('\t\t\t') lines.append('\t\t\t\t') lines.append('\t\t\t\t\tru') - lines.append(f'\t\t\t\t\t{esc_xml(str(av["presentation"]))}') + lines.append(f'\t\t\t\t\t{esc_xml(av_pres)}') lines.append('\t\t\t\t') lines.append('\t\t\t') lines.append('\t\t') diff --git a/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json b/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json new file mode 100644 index 00000000..9407e6a0 --- /dev/null +++ b/tests/skills/cases/skd-compile/parameter-title-presentation-synonyms.json @@ -0,0 +1,27 @@ +{ + "name": "Parameter.presentation и availableValue.title — синонимы", + "params": { "outputPath": "Template.xml" }, + "input": { + "dataSets": [{ + "name": "Основной", + "query": "ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т", + "fields": ["Сумма: decimal(15,2)"] + }], + "parameters": [ + { + "name": "ПорядокОкругления", + "presentation": "Округление", + "type": "EnumRef.Округления", + "value": "Перечисление.Округления.Окр1_00", + "availableValues": [ + { "value": "Перечисление.Округления.Окр1_00", "title": "руб. коп" }, + { "value": "Перечисление.Округления.Окр1", "presentation": "руб." } + ] + } + ] + }, + "validatePath": "Template.xml", + "expect": { + "files": ["Template.xml"] + } +} diff --git a/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml b/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml new file mode 100644 index 00000000..4f2ce774 --- /dev/null +++ b/tests/skills/cases/skd-compile/snapshots/parameter-title-presentation-synonyms/Template.xml @@ -0,0 +1,83 @@ + + + + ИсточникДанных1 + Local + + + Основной + + Сумма + Сумма + + xs:decimal + + 15 + 2 + Any + + + + ИсточникДанных1 + ВЫБРАТЬ Т.Сумма ИЗ Регистр КАК Т + + + ПорядокОкругления + + <v8:item> + <v8:lang>ru</v8:lang> + <v8:content>Округление</v8:content> + </v8:item> + + + d5p1:EnumRef.Округления + + Перечисление.Округления.Окр1_00 + + Перечисление.Округления.Окр1_00 + + + ru + руб. коп + + + + + Перечисление.Округления.Окр1 + + + ru + руб. + + + + + + Основной + + + ru + Основной + + + + + + + + + + + + + + + +