Figma Support Forum

How to associate variants with their main-component's name via the API?

I have a Tooltip component variant and it returns as this via the Rest API:

"21067:257": {
    "key": "7cd98dcc2b6254c6748612e6154a91736f27ba7b",
    "name": "Arrow Position=left, Resizable=false, Color=dark",
    "description": ""
},
"21067:269": {
    "key": "50a3029f71543ccb93264de6de85fa97b666c25b",
    "name": "Arrow Position=left, Resizable=false, Color=brand",
    "description": ""
},
"21067:281": {
    "key": "7e1aaf60fc46e77d9cfc6790e388dc3f35067b5d",
    "name": "Arrow Position=left, Resizable=false, Color=light",
    "description": ""
},

I’m trying to search for ‘Tooltip’ by name and return a list of matching components. The name property on a variant lacks any correlation back to the main-component name, in this case Tooltip.

Looking for guidance on how to associate them, ideally not having to fill in a description with the name for each one.

I suppose I could search on the document children instead and walk the tree of COMPONENT_SETS and make some determinations