Re: [community-group] [Format] Object vs Array (#55)

@ivnmaksimovic 

> [...] I think that example with the path you provided might create some confusion. You propose that "path" is "object group" / "actual token name". But I assume that if you ask anyone familiar with json format, what is the path of the token 2, the answer will probably be "object group" / "token 2". No need to check the documentation for such a trivial question, right?

I agree it's a bit unintuitive when looking at the raw JSON (and perhaps it's not a great proposal for that reason). On the other hand, saying that a `name` attribute always overrides the index / key of the enclosing array / object group also has a nice consistency to it. I think it might be more confusing if it only has an effect in arrays but gets ignored otherwise.

Also, there may be some rare edge-cases where it's useful to be able to tweak the path. For example, `description` is a reserved word in the spec as it is used to provide description text for tokens and groups. Therefore, you cannot have a token or group whose name is `description`. However, using the `name` attribute you could:

```jsonc
{
  "card": {
    "color": {
      "title": {
        "type": "color",
        "value": "#000000"
      },
      "ignored": {
        "name": "description",
        "type": "color",
        "value": "#777777",
      }
    }
  }
}
```

An export tool that supports our format would most likely use a token's path to generate variable names to output. So, if exporting to SASS, the above token file might produce something like this:

```scss
$card-color-title: #000000;
$card-color-description: #777777; // probably more appropriate than $card-color-ignored, right?
```

-- 
GitHub Notification of comment by c1rrus
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/55#issuecomment-919555973 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 14 September 2021 22:26:13 UTC