Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing nested aliases type validation #309

Closed
nclsndr opened this issue Sep 19, 2024 · 1 comment · Fixed by #313
Closed

Failing nested aliases type validation #309

nclsndr opened this issue Sep 19, 2024 · 1 comment · Fixed by #313
Labels
bug Something isn't working parser @terrazzo/cli

Comments

@nclsndr
Copy link
Contributor

nclsndr commented Sep 19, 2024

The tokens parser is capable of catching type mismatches for scalar types but ignore the composites.

parse([{
  src: JSON.stringify({
    color: {
      $type: 'color',
      blue: {
        $value: '#10109A',
      },
    },
    dimension: {
      base: {
        $type: 'dimension',
        $value: '{color.blue}', // should be dimension: caught by parser ✅
      },
    },
    border: {
      base: {
        $type: 'border',
        $value: '{dimension.base}', // should be border: caught by parser ✅
      },
      nested: {
        $type: 'border',
        $value: {
          color: '{color.blue}',
          width: '{color.blue}', // should be dimension: silently failing ❌
          style: 'solid',
        },
      },
    },
  })
}])

I think that's not much of a deal, yet I preferred to report it while looking into it.


The only solution I found on my end was to manually declare the mapping.

@nclsndr nclsndr changed the title Nested aliases type validation Failing nested aliases type validation Sep 19, 2024
@drwpow drwpow added bug Something isn't working parser @terrazzo/cli labels Sep 19, 2024
@drwpow
Copy link
Collaborator

drwpow commented Sep 19, 2024

Ah that’s a great catch, thank you! Worth fixing for sure. I like your mapping approach; great suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser @terrazzo/cli
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants