ARI icon indicating copy to clipboard operation
ARI copied to clipboard

[Request]: Add compatibility with LucidChart

Open thetalljosh opened this issue 2 weeks ago • 0 comments

Description:

The current draw.io diagram output uses wrapper elements with label attributes to store metadata and text labels. While this works perfectly in draw.io, it creates compatibility issues when importing into other diagramming tools like Lucidchart.

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 pattern.

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 wrapper pattern. This would maintain all functionality while ensuring cross-platform compatibility.

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 elements to <mxCell value=""> attributes, making the output compatible with Lucidchart while maintaining draw.io compatibility.

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 or be moved to <mxCell>)

thetalljosh avatar Dec 12 '25 17:12 thetalljosh