feat(meta-edit): support composite types via + separator

Build-TypeContentXml / build_type_content_xml now detect " + " in type
string, split into parts and recursively generate separate <v8:Type>
entries with qualifiers for each type. JSON DSL supports type as array.

Also fix reference types to use local xmlns:d5p1 declaration instead of
root-level cfg: prefix — prevents "Неизвестное имя типа" build errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-05 11:32:59 +03:00
co-authored by Claude Opus 4.6
parent 6958cc558b
commit 4490aeb533
5 changed files with 57 additions and 6 deletions
+13 -3
View File
@@ -188,6 +188,16 @@ def build_type_content_xml(indent, type_str):
if not type_str:
return ""
# Composite type: "Type1 + Type2 + Type3"
if " + " in type_str:
parts = [p.strip() for p in type_str.split("+")]
results = []
for part in parts:
inner = build_type_content_xml(indent, part)
if inner:
results.append(inner)
return "\r\n".join(results)
type_str = resolve_type_str(type_str)
lines = []
@@ -258,14 +268,14 @@ def build_type_content_xml(indent, type_str):
lines.append(f"{indent}<v8:TypeSet>cfg:DefinedType.{dt_name}</v8:TypeSet>")
return "\r\n".join(lines)
# Reference types
# Reference types — use local xmlns declaration for 1C compatibility
m = re.match(
r"^(CatalogRef|DocumentRef|EnumRef|ChartOfAccountsRef|ChartOfCharacteristicTypesRef|"
r"ChartOfCalculationTypesRef|ExchangePlanRef|BusinessProcessRef|TaskRef)\.(.+)$",
type_str,
)
if m:
lines.append(f"{indent}<v8:Type>cfg:{type_str}</v8:Type>")
lines.append(f'{indent}<v8:Type xmlns:d5p1="http://v8.1c.ru/8.1/data/enterprise/current-config">d5p1:{type_str}</v8:Type>')
return "\r\n".join(lines)
# Fallback
@@ -538,7 +548,7 @@ def parse_attribute_shorthand(val):
name = str(val.get("name", ""))
result = {
"name": name,
"type": str(val.get("type", "")),
"type": " + ".join(str(t) for t in val["type"]) if isinstance(val.get("type"), list) else str(val.get("type", "")),
"synonym": str(val.get("synonym", "")) if val.get("synonym") else split_camel_case(name),
"comment": str(val.get("comment", "")),
"flags": list(val.get("flags", [])),