Open romainmenke opened 1 year ago
Interesting! It's funny that JSON allows for this.
My feeling is that token names have to be non-zero. I can't imagine a use case for a token called "" ... but open to possibilities if we can think of them.
My feeling is that token names have to be non-zero.
I agree.
This is allowed in today's specification text, but is really awkward.
{
"": {
"": {
"": {
"": { "$value": "3rem" }
}
}
}
}
Token ...
has value 3rem
I found this useful for stepped tokens where the middle value represents what people think of as the color:
{
“color”: {
“primary”: {
…
“04”: { "$value": “#aa0000” },
“05”: { "$value": “#bb0000” },
"": { "$value": “#bb0000” },
“06”: { "$value": “#cc0000” },
…
}
}
}
Which can be transformed into:
…
color-primary-04: #aa0000;
color-primary-05: #bb0000;
color-primary: #bb0000;
color-primary-06: #cc0000;
…
@srouse That looks like a bug in your translation tool :/
I don't understand why it would convert this to color-primary
.
It should be color-primary-
when following the naming logic for the other tokens.
Now you have a naming conflict between a specific token and a token group.
It does illustrate why it is important for the specification to be explicit about allowing this or not. It is an edge case that should not be overlooked by implementers.
Related to #200
The current specification does not require token names to be strings with a non-zero length.
https://tr.designtokens.org/format/#name-and-value
This parses just fine :
Is this intended?