mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-12 08:54:57 +03:00
fix(skd-compile): авто-определение xs:decimal по тексту числа
Для filter right value compile уже различал bool / native-number / dateTime, но не различал числовые строки. Реальные отчёты часто хранят сравнения как числа: <right xsi:type=\"xs:decimal\">5</right>. Decompile при чтении видит "5" как строку (через InnerText), и без этого фикса compile эмитил xs:string. Теперь добавлена проверка по regex ^-?\d+(\.\d+)?$ → xs:decimal. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# skd-compile v1.47 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.48 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -2011,6 +2011,7 @@ function Emit-FilterItem {
|
||||
if ($v -is [bool]) { $vt = 'xs:boolean' }
|
||||
elseif ($v -is [int] -or $v -is [long] -or $v -is [double]) { $vt = 'xs:decimal' }
|
||||
elseif ("$v" -match '^\d{4}-\d{2}-\d{2}T') { $vt = 'xs:dateTime' }
|
||||
elseif ("$v" -match '^-?\d+(\.\d+)?$') { $vt = 'xs:decimal' }
|
||||
else { $vt = 'xs:string' }
|
||||
}
|
||||
$vStr = if ($v -is [bool]) { "$v".ToLower() } else { Esc-Xml "$v" }
|
||||
@@ -2027,6 +2028,8 @@ function Emit-FilterItem {
|
||||
$vt = "xs:decimal"
|
||||
} elseif ("$v" -match '^\d{4}-\d{2}-\d{2}T') {
|
||||
$vt = "xs:dateTime"
|
||||
} elseif ("$v" -match '^-?\d+(\.\d+)?$') {
|
||||
$vt = "xs:decimal"
|
||||
} else {
|
||||
$vt = "xs:string"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# skd-compile v1.47 — Compile 1C DCS from JSON
|
||||
# skd-compile v1.48 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import json
|
||||
@@ -1678,6 +1678,8 @@ def emit_filter_item(lines, item, indent):
|
||||
vt = 'xs:decimal'
|
||||
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
||||
vt = 'xs:dateTime'
|
||||
elif re.match(r'^-?\d+(\.\d+)?$', str(v)):
|
||||
vt = 'xs:decimal'
|
||||
else:
|
||||
vt = 'xs:string'
|
||||
v_str = str(v).lower() if isinstance(v, bool) else esc_xml(str(v))
|
||||
@@ -1692,6 +1694,8 @@ def emit_filter_item(lines, item, indent):
|
||||
vt = 'xs:decimal'
|
||||
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
||||
vt = 'xs:dateTime'
|
||||
elif re.match(r'^-?\d+(\.\d+)?$', str(v)):
|
||||
vt = 'xs:decimal'
|
||||
else:
|
||||
vt = 'xs:string'
|
||||
if isinstance(val, bool):
|
||||
|
||||
Reference in New Issue
Block a user