Add schema bundling package and conformance test suite#1
Open
Add schema bundling package and conformance test suite#1
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)src/2025.10/) to use absolute$id-based$refreferences 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).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.scripts/bundle.ts): Readsschemas.config.json, registers all source schemas fromsrc/<version>/by their$idwith@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/andwww/public/schemas/).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)positive/andnegative/directories covering all token types, references, groups, metadata, token naming, and the resolver spec.README.mdandCONTRIBUTING.mdwith structure docs and contribution guidelines.Monorepo
pnpm-workspace.yaml.build:schemasto root build pipeline..gitignoreand bundled output inwww/public/schemas/.How to test
AJV tests
pnpm install pnpm run build:schemas pnpm testVS 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:Clone and build the fork as a sibling directory:
Add the override to the root
package.json:{ "pnpm": { "overrides": { "vscode-json-languageservice": "file:../vscode-json-languageservice-keegan" } } }Unskip the test in
schemas/tests/validate-vscode.test.ts:Run:
pnpm install pnpm run build:schemas pnpm testTo switch back, remove the
pnpm.overridesblock, runpnpm install, and re-skip the test.Driveby fix:
Add Webstudio to the allowed company names list