tokens-studio / figma-plugin

Official repository of the plugin 'Tokens Studio for Figma' (Figma Tokens)
https://www.figma.com/community/plugin/843461159747178978
MIT License
1.32k stars 190 forks source link

2.0: Defining type at the group level is not being persisted in JSON #2931

Open six7 opened 3 days ago

six7 commented 3 days ago

We seem to have caused a regression with defining type at the group level. It seems we no longer save it in the JSON.

To reproduce:

{
  "scale": {
    "type": "spacing",
    "small": {
      "value": "4px",
    },
    "medium": {
      "value": "8px",
    },
    "large": {
      "value": "12px",
      "type": "sizing"
    }
  }
}

Expected: We keep JSON as is Actual: We strip away the type from the group level and insert a blank key.

This might have something to do with how we stringify the JSON back, and the inheritTypeLevel property that we set internally.

Note: This does not happen if I am on the W3C DTCG format, maybe that can be helpful in understanding what went wrong here.

https://github.com/tokens-studio/figma-plugin/assets/4548309/b66ddfa4-f364-4f90-81b8-90e3f4606745