Open Design Tokens
    Preparing search index...

    Function validateDtcg

    • 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.

      Parameters

      Returns ValidationResult

      const result = validateDtcg({
      color: { primary: { $type: 'color', $value: { colorSpace: 'srgb', components: [1, 0, 0] } } },
      });
      result.valid; // true