figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

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

Open six7 opened this issue 7 months ago • 0 comments

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:

  • Paste the following JSON in the plugin:
{
  "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

six7 avatar Jul 01 '24 07:07 six7