Skip to content

Add schema bundling package and conformance test suite#1

Open
dgtlntv wants to merge 16 commits intomainfrom
bundle-and-test
Open

Add schema bundling package and conformance test suite#1
dgtlntv wants to merge 16 commits intomainfrom
bundle-and-test

Conversation

@dgtlntv
Copy link
Copy Markdown
Owner

@dgtlntv dgtlntv commented Mar 11, 2026

Overview

Adds two new packages to the monorepo: @dtcg/schemas (schema bundling, build tooling, and validation tests) and @dtcg/test-suite (200+ conformance test fixtures for the Format and Resolver specs).

Changes

schemas/ (Schema package)

  • Moved and refactored source schemas (src/2025.10/) to use absolute $id-based $ref references instead of relative file paths (even with the pending fixes for vscode's json language service it is confused by the relative paths in the bundled schema. Since we are now bundling the schema the absolute refs might be nicer anyways).
  • Config (schemas.config.json): Declarative config that drives both the bundle script and the test runner. It declares which spec versions exist, which root schemas to bundle per version, and where source/output/test directories live. Adding a new spec version or schema is just adding an entry here; no build script changes needed.
  • Bundle script (scripts/bundle.ts): Reads schemas.config.json, registers all source schemas from src/<version>/ by their $id with @hyperjump/json-schema, then bundles each entry schema into a single self-contained file with all $refs inlined. Output is written to every directory listed in the config (schemas/dist/ and www/public/schemas/).
  • Tests (tests/):
    • validate-ajv.test.ts: Validates all fixtures with AJV (draft-07, strict mode). AJV is one of the most widely used JSON Schema validators in the JS ecosystem, so we want to make sure the schemas work correctly with it.
    • validate-vscode.test.ts: Validates with the VS Code JSON language service. VS Code is one of the most used editors, so we want to ensure users get correct validation when referencing the DTCG schemas via $schema. Currently skipped because the service can't resolve $id-based $refs; fix pending upstream.
    • helpers.ts: Shared manifest loading and test generation.

test-suite/ (Conformance fixtures)

  • 200+ fixtures across positive/ and negative/ directories covering all token types, references, groups, metadata, token naming, and the resolver spec.
  • Manifest-driven discovery: Root and sub-manifests list every test case with id, type, name, purpose, input path, and feature tags.
  • README.md and CONTRIBUTING.md with structure docs and contribution guidelines.

Monorepo

  • Added both packages to pnpm-workspace.yaml.
  • Added build:schemas to root build pipeline.
  • Updated .gitignore and bundled output in www/public/schemas/.

How to test

AJV tests

pnpm install
pnpm run build:schemas
pnpm test

VS Code JSON language service fork

The bundled schemas use $id-based $refs which the VS Code JSON language service doesn't currently resolve. There is an open PR to fix this upstream. The fork below is the branch from that PR, so you can test against the fix before it lands:

  1. Clone and build the fork as a sibling directory:

    git clone -b users/keegancaruso/2019-09-schema \
      https://github.com/keegan-caruso/vscode-json-languageservice.git \
      vscode-json-languageservice-keegan
    
    cd vscode-json-languageservice-keegan
    npm install && npm run compile
    cd ../community-group
  2. Add the override to the root package.json:

    {
      "pnpm": {
        "overrides": {
          "vscode-json-languageservice": "file:../vscode-json-languageservice-keegan"
        }
      }
    }
  3. Unskip the test in schemas/tests/validate-vscode.test.ts:

    - describe.skip('vscode-json-languageservice', () => {
    + describe('vscode-json-languageservice', () => {
  4. Run:

    pnpm install
    pnpm run build:schemas
    pnpm test

To switch back, remove the pnpm.overrides block, run pnpm install, and re-skip the test.

Driveby fix:
Add Webstudio to the allowed company names list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant