Skip to content

Bundle JSON schema#412

Merged
drwpow merged 3 commits into
design-tokens:mainfrom
dgtlntv:pr/01-schema-package
Jun 9, 2026
Merged

Bundle JSON schema#412
drwpow merged 3 commits into
design-tokens:mainfrom
dgtlntv:pr/01-schema-package

Conversation

@dgtlntv

@dgtlntv dgtlntv commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Changes

This PR moves JSON schemas from www/public/schemas/ into a dedicated schemas package with modular source files and a bundling step. The build script uses @hyperjump/json-schema to bundle split schema files (with $ref) into self-contained output files.

As brought up by @drwpow in this PR discussion schema store expects bundled schemas if the schema is stored somewhere else. I kept the source as separate schemas + a bundling step because I think the schema would be easier to maintain this way, especially once the specification grows more.

Having the schema be a separate package (rather than be part of the www package) could have other positive effects. It would be easier to use the schema to test other packages. For example the schema could be used as part of a test in the technical-reports package to test whether the code snippets inside it are valid design token json. (I would contribute this as a separate PR).

As discussed in this PR the bundled schema would not work in VScode right now. But the PR for the vscode-json-languageservice that is fixing this issue seems to be close to being merged. We could delay this PR until that one lands in the vscode-json-languageservice.

In a followup PR I would add tests for the schemas package. These tests would run the schemas against fixtures using both ajv and vscode-json-languageservice that way we can be sure in the future that the JSON schema works properly with VScode.

After this PR is merged we could proceed with contributing this schema to schemastore.

How to Review

  • Verify the bundled schema still works properly to validate design token json files (for example with ajv or similar)
  • Verify the www package builds properly and serves the bundled json schema
  • Verify the build script and package set up aligns with this repos code standards etc.

dgtlntv and others added 3 commits April 10, 2026 12:11
Move JSON schemas from www/public/schemas/ into a dedicated
schemas package with modular source files and a bundling step.
The build script uses @hyperjump/json-schema to bundle split
schema files (with $ref) into self-contained output files.

- Add schemas/src/ with modular format and resolver schemas
- Add bundle.ts build script and schemas.config.json
- Add schemas to pnpm workspace and root build pipeline
- Add build:schemas step to CI workflow
- Remove previously committed bundled schemas from www/public/
  (now generated via build and gitignored)
@netlify

netlify Bot commented Jun 2, 2026

Copy link
Copy Markdown

Deploy Preview for designtokensorg ready!

Name Link
🔨 Latest commit 6ceaab1
🔍 Latest deploy log https://app.netlify.com/projects/designtokensorg/deploys/6a1ead729801cc00088686f7
😎 Deploy Preview https://deploy-preview-412--designtokensorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@drwpow drwpow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you for taking the time to do this! This had dropped off my list, apologies. Appreciate you taking the time.

I like your choices in regard to a new schemas package—that keeps it clean and debuggable. And library seems like a great choice for bundling.

I don’t have any feedback at this stage, let’s just ship this and adjust if anything comes up. This seems like a great foundation to build off of.

Comment thread schemas/scripts/bundle.ts
registerSchema,
type SchemaObject,
} from '@hyperjump/json-schema/draft-07';
import { bundle } from '@hyperjump/json-schema/bundle';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find!

@drwpow drwpow merged commit 11f95e8 into design-tokens:main Jun 9, 2026
8 checks passed
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.

2 participants