- From: Justin Fagnani via GitHub <sysbot+gh@w3.org>
- Date: Sat, 22 Jul 2023 20:50:10 +0000
- To: public-design-tokens-log@w3.org
justinfagnani has just created a new issue for https://github.com/design-tokens/community-group: == The $ property name prefix should be unnecessary with a well-structured schema == I was looking into this format recently and I came away quite confused why the `$` prefix was required everywhere. The rationale pointed to in the format spec (https://design-tokens.github.io/community-group/format/#additional-group-properties) indicates that it's to differentiate between group properties and the tokens within a group. How this is usually handled in JSON is that the key/value maps are separated from the data structurally - they don't mix in a single object. For groups, all the _child_ tokens would be in a sub-object called `children` or `tokens`, and so could never clash with group _properties_ like `description`. So a group would look like: ```json { "Group of tokens": { "description": "This is an example of a group containing a nested group", "tokens": { "Subgroup of tokens": { "Token 1 name": { "value": "#aabbcc" }, "Token 2 name": { "value": "#ddeeff" } } } } } ``` Many, many JSON schemas have both defined properties and open-ended key/value maps and work just fine without prefixing every defined property name in the schema. This spec is the first I've ever seen that does it, and I think it harms the human readability of the documents. It also makes programatic handling of groups more difficult, because to get child tokens you need to filter on a group name prefix instead of just getting the keys of the `children` property. Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/225 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 22 July 2023 20:50:12 UTC