[Request]: Add compatibility with LucidChart
Description:
The current draw.io diagram output uses
Issue: When importing Azure Resource Inventory-generated diagrams into Lucidchart, all resource labels (resource group names, resource counts, etc.) are missing because Lucidchart doesn't recognize the
Current Structure:
<object label="rgname-prod-rg" id="sdhfksjhfeuhfe-123">
<mxCell parent="1" style="..." vertex="1">
<mxGeometry ... />
</mxCell>
</object>
Required Structure for Lucidchart:
Proposed Solution: Add an optional parameter (e.g., -LucidchartCompatible) that transforms the output to use mxGraph's standard value attribute on <mxCell> elements instead of the
Workaround (for others encountering this): The output can be transformed quickly to make the import process smoother, using the following powershell:
# transform script for draw.io XML
param(
[Parameter(Mandatory=$true)]
[string]$InputFile,
[Parameter(Mandatory=$false)]
[string]$OutputFile
)
if (-not $OutputFile) {
$OutputFile = $InputFile -replace '\.drawio$', '_fixed.drawio'
}
# Read file as XML properly
[xml]$xml = Get-Content $InputFile -Raw -Encoding UTF8
# Find all <object> elements with label attributes
$objects = $xml.SelectNodes("//object[@label]")
Write-Host "Found $($objects.Count) object elements to transform"
foreach ($obj in $objects) {
$label = $obj.GetAttribute("label")
$objectId = $obj.GetAttribute("id")
# Find the nested mxCell
$mxCell = $obj.SelectSingleNode("mxCell")
if ($mxCell) {
# Add the value attribute to mxCell
$mxCell.SetAttribute("value", $label)
# Move the id to mxCell if it doesn't have one
if (-not $mxCell.GetAttribute("id")) {
$mxCell.SetAttribute("id", $objectId)
}
# Get the parent of the object element
$parent = $obj.ParentNode
# Replace object with just the mxCell
$parent.ReplaceChild($mxCell, $obj) | Out-Null
}
}
# Save the modified XML
$xml.Save($OutputFile)
Write-Host "Transformed XML saved to: $OutputFile" -ForegroundColor Green
This script post-processes the diagram XML to move labels from
Benefits:
Enables use of Azure Resource Inventory diagrams in Lucidchart Maintains backward compatibility (make it optional) No loss of metadata (custom attributes can remain on