Re: [community-group] How to do tokens that share a name with a group (#97)

Ok, returning to this after having some experience with trying to parse larger token files, I think some kind of explicit key is necessary. The main reason is that groups can have properties that are named the same as tokens. For example:

```json
{
  "color": {
    "$type": "color",
    "$description": "lorem ipsum",
    "$value": "blue",
    "primary": {
      "$value": "red"
    }
  }
}
```

In this example, it's unclear if the "$type" at the root applies to the root token, "color" (blue) or is intended to cascade down to child tokens like "color.primary". Same with description; is it a description for the group? or a description of the root token?

So, I'd like to recommend the following change to the group format:

```
"groupName": {
  "$type": "..."          // optional type that can be inherited by children
  "$description": "..."   // optional description of the group
  "$rootToken": {}        // optional root token
  "$extensions": {}       // optional extensions as usual
  "childName": {}         // required, can be a group or a token.
  }
  ```
  
I'm open to other names, but I chose "rootToken" to be very explicit that this should be a token that is associated with the root of the group. I also considered "root" and "base". I deliberately avoided "default", as this doesn't quite make sense grammatically — a default implies options, which isn't how groups work.

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


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

Received on Tuesday, 19 December 2023 15:10:11 UTC