mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-26 22:51:03 +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:
co-authored by
Claude Opus 4.7
parent
03cc59d243
commit
cbad0fe743
@@ -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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[string]$DefinitionFile,
|
[string]$DefinitionFile,
|
||||||
@@ -2011,6 +2011,7 @@ function Emit-FilterItem {
|
|||||||
if ($v -is [bool]) { $vt = 'xs:boolean' }
|
if ($v -is [bool]) { $vt = 'xs:boolean' }
|
||||||
elseif ($v -is [int] -or $v -is [long] -or $v -is [double]) { $vt = 'xs:decimal' }
|
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{4}-\d{2}-\d{2}T') { $vt = 'xs:dateTime' }
|
||||||
|
elseif ("$v" -match '^-?\d+(\.\d+)?$') { $vt = 'xs:decimal' }
|
||||||
else { $vt = 'xs:string' }
|
else { $vt = 'xs:string' }
|
||||||
}
|
}
|
||||||
$vStr = if ($v -is [bool]) { "$v".ToLower() } else { Esc-Xml "$v" }
|
$vStr = if ($v -is [bool]) { "$v".ToLower() } else { Esc-Xml "$v" }
|
||||||
@@ -2027,6 +2028,8 @@ function Emit-FilterItem {
|
|||||||
$vt = "xs:decimal"
|
$vt = "xs:decimal"
|
||||||
} elseif ("$v" -match '^\d{4}-\d{2}-\d{2}T') {
|
} elseif ("$v" -match '^\d{4}-\d{2}-\d{2}T') {
|
||||||
$vt = "xs:dateTime"
|
$vt = "xs:dateTime"
|
||||||
|
} elseif ("$v" -match '^-?\d+(\.\d+)?$') {
|
||||||
|
$vt = "xs:decimal"
|
||||||
} else {
|
} else {
|
||||||
$vt = "xs:string"
|
$vt = "xs:string"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/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
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
@@ -1678,6 +1678,8 @@ def emit_filter_item(lines, item, indent):
|
|||||||
vt = 'xs:decimal'
|
vt = 'xs:decimal'
|
||||||
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
||||||
vt = 'xs:dateTime'
|
vt = 'xs:dateTime'
|
||||||
|
elif re.match(r'^-?\d+(\.\d+)?$', str(v)):
|
||||||
|
vt = 'xs:decimal'
|
||||||
else:
|
else:
|
||||||
vt = 'xs:string'
|
vt = 'xs:string'
|
||||||
v_str = str(v).lower() if isinstance(v, bool) else esc_xml(str(v))
|
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'
|
vt = 'xs:decimal'
|
||||||
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
elif re.match(r'^\d{4}-\d{2}-\d{2}T', str(v)):
|
||||||
vt = 'xs:dateTime'
|
vt = 'xs:dateTime'
|
||||||
|
elif re.match(r'^-?\d+(\.\d+)?$', str(v)):
|
||||||
|
vt = 'xs:decimal'
|
||||||
else:
|
else:
|
||||||
vt = 'xs:string'
|
vt = 'xs:string'
|
||||||
if isinstance(val, bool):
|
if isinstance(val, bool):
|
||||||
|
|||||||
Reference in New Issue
Block a user