Decode SCD data sources from live XML
This commit is contained in:
@@ -36071,7 +36071,7 @@ def scd_inspect(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
if not report:
|
||||
return invalid_argument(method, "report", "report is required as a public 1C report name.")
|
||||
schema_name = str(payload.get("schema") or "").strip()
|
||||
requested_sections = payload.get("sections") or ["parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
|
||||
requested_sections = payload.get("sections") or ["data_sources", "parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
|
||||
if not isinstance(requested_sections, list) or not all(isinstance(item, str) for item in requested_sections):
|
||||
return invalid_argument(method, "sections", "sections must be an array of strings.")
|
||||
resolve_metadata, resolve_metadata_error = strict_bool_argument(payload, "resolve_metadata", method=method, default=True)
|
||||
|
||||
@@ -161,6 +161,10 @@ def scd_node_item(root: ET.Element, node: ET.Element, category: str) -> dict[str
|
||||
item["value_type"] = value_type
|
||||
if category == "datasets":
|
||||
item["type"] = node.attrib.get("{http://www.w3.org/2001/XMLSchema-instance}type") or node.attrib.get("type") or ""
|
||||
if category == "data_sources":
|
||||
data_source_type = child_text(node, "dataSourceType")
|
||||
if data_source_type:
|
||||
item["data_source_type"] = data_source_type
|
||||
return item
|
||||
|
||||
|
||||
@@ -171,7 +175,7 @@ def inspect_scd_payload(data: bytes, *, sections: list[str] | None = None) -> di
|
||||
synthesized from report code or form attributes.
|
||||
"""
|
||||
|
||||
requested = sections or ["parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
|
||||
requested = sections or ["data_sources", "parameters", "datasets", "fields", "calculated_fields", "resources", "settings", "variants", "total_fields"]
|
||||
root, container = xml_from_scd_payload(data)
|
||||
if root is None:
|
||||
return {"status": "partial", "container": container, "sections": {name: [] for name in requested}}
|
||||
@@ -198,6 +202,7 @@ def inspect_scd_payload(data: bytes, *, sections: list[str] | None = None) -> di
|
||||
tag = local_name(node.tag)
|
||||
xml_tag_counts[tag] = xml_tag_counts.get(tag, 0) + 1
|
||||
node_names = {
|
||||
"data_sources": {"dataSource"},
|
||||
"parameters": {"parameter"},
|
||||
"datasets": {"dataSet"},
|
||||
"fields": {"field"},
|
||||
|
||||
Reference in New Issue
Block a user