[community-group] Token aliases with invalid or unsuited intermediate value (#196)

romainmenke has just created a new issue for https://github.com/design-tokens/community-group:

== Token aliases with invalid or unsuited intermediate value ==
https://tr.designtokens.org/format/#aliases-references

> When a tool needs the actual value of a token it MUST resolve the reference - i.e. lookup the token being referenced and fetch its value. In the above example, the "alias name" token's value would resolve to 1234 because it references the token whose path is {group name.token name} which has the value 1234.
>
> Tools SHOULD preserve references and therefore only resolve them whenever the actual value needs to be retrieved. For instance, in a [design tool](https://tr.designtokens.org/format/#dfn-design-tool), changes to the value of a token being referenced by aliases SHOULD be reflected wherever those aliases are being used.
>
> Aliases MAY reference other aliases. In this case, tools MUST follow each reference until they find a token with an explicit value. Circular references are not allowed. If a design token file contains circular references, then the value of all tokens in that chain is unknown and an appropriate error or warning message SHOULD be displayed to the user.


https://tr.designtokens.org/format/#type-0

> A token's type can be specified by the optional $type property. If the $type property is not set on a token, then the token's type MUST be determined as follows:
>
> - If the token's value is a reference, then its type is the type of the token being referenced.
> - Otherwise, if any of the token's parent groups have a $type property, then the token's type is inherited from the closest parent group with a $type property.
> - Otherwise, the token's type is whichever of the basic JSON types (string, number, boolean, object, array or null) its value is.

Example :

```json
{
 "one": {
  "$type": "color",
  "$value": "#ffffff"
 },
 "two": {
  "$type": "dimension",
  "$value": "{one}"
 },
 "three": {
  "$type": "color",
  "$value": "{two}"
 }
}
```

Is `three` a valid color token with value `#ffffff` ?

Currently this is ambiguous because there are not precisely defined parsing steps.

Dereferencing aliases doesn't mention type at all.
So it seems that types aren't a factor for this process.

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/196 using your GitHub account


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

Received on Wednesday, 7 December 2022 17:22:45 UTC