fix(1c): retain descriptor role in template inventory

This commit is contained in:
2026-08-14 20:57:30 +03:00
parent 24c6c6e170
commit a646b53aec
2 changed files with 7 additions and 5 deletions
+5 -2
View File
@@ -4105,9 +4105,10 @@ def template_descriptor_type_code_from_part(part: dict[str, Any]) -> str | None:
The code is useful evidence, but its numeric-to-TemplateType mapping is
intentionally not guessed from the payload carrier or a template name.
"""
if str(part.get("role") or "") != "metadata_payload":
return None
classification = part.get("classification") if isinstance(part.get("classification"), dict) else {}
role = str(part.get("role") or classification.get("role") or "")
if role != "metadata_payload":
return None
tree = classification.get("tree")
if not isinstance(tree, dict):
return None
@@ -42511,6 +42512,8 @@ def metadata_object_templates(payload: dict[str, Any]) -> dict[str, Any]:
for part in parts_result.get("parts") or []:
classification = part.get("classification") or {}
public_part = payload_public_properties(classification)
if classification.get("role"):
public_part["role"] = classification.get("role")
descriptor_type_code = template_descriptor_type_code_from_part(part)
if descriptor_type_code is not None:
public_part["descriptor_type_code"] = descriptor_type_code