Validates a DTCG design tokens document.
Accepts a parsed object, a JSON string, or a document from prepareDocument. Invalid input of any shape yields diagnostics in the result; it never throws. The only exception is an unknown spec option, which is a programmer error.
spec
const result = validateDtcg({ color: { primary: { $type: 'color', $value: { colorSpace: 'srgb', components: [1, 0, 0] } } },});result.valid; // true Copy
const result = validateDtcg({ color: { primary: { $type: 'color', $value: { colorSpace: 'srgb', components: [1, 0, 0] } } },});result.valid; // true
Validates a DTCG design tokens document.
Accepts a parsed object, a JSON string, or a document from prepareDocument. Invalid input of any shape yields diagnostics in the result; it never throws. The only exception is an unknown
specoption, which is a programmer error.