design-token-validator icon indicating copy to clipboard operation
design-token-validator copied to clipboard

Alias not resolved

Open omh opened this issue 10 months ago • 1 comments

Hello 👋 Thanks for putting together this validator and thanks for making it available to the public. It's great to have a validator so we can better align the implementations of design tokens.

I'm wondering if there's a bug resolving aliases? I expect this example to be valid:

{
  "Action": {
    "$type": "shadow",
    "$value": {
      "blur": "2px",
      "color": "{one}",
      "offsetX": "0px",
      "offsetY": "1px",
      "spread": "0px"
    }
  },
  "one": {
    "$type": "color",
    "$value": "#FFFFFF"
  }
}

However I get the following error:

Value "{one}" for token "Action" is not a valid color value

A color token resolving another color token's value works however:

{
  "my color": {
    "$type": "color",
    "$value": "{one}"
  },
  "one": {
    "$type": "color",
    "$value": "#FFFFFF"
  }
}

Thanks again!

omh avatar Apr 23 '24 07:04 omh

Hello, It's possible that alias inside composite $value are not resolving well.

We are not doing a lot of improvement on this repo nowadays, but if you want to add a test for this use case and try to fix it with a PR, we are here to review and assist if needed.

Kubessandra avatar May 13 '24 09:05 Kubessandra