Registry / database / vega-schema

vega-schema

JSON →
library6.2.0jsnpmunverified

Package to generate the Vega visualization grammar JSON schema. Version 6.2.0 is the latest stable release. Used internally by Vega tooling; end users typically consume the pre-built schema from the vega package or directly from the Vega repository. Differentiator: provides programmatic schema generation for custom builds.

npm install vega-schema
INSTALL
IMPORT
SIG · VEGA-SCHEMA
V
vega-schema
databasejavascriptv6.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

build
import { build } from 'vega-schema';
const build = require('vega-schema');
Package is ESM-only, named export 'build' function.
build (default)
import build from 'vega-schema';
Default export also available, same as named export.
TypeScript types
import type { Schema } from 'vega-schema';
import { Schema } from 'vega-schema';
Use import type for TypeScript type-only imports to avoid runtime errors.

Demonstrates generating the Vega schema using the build function and logging the schema URI.

import { build } from 'vega-schema'; const schema = build(); console.log(schema.$schema); // Outputs: http://json-schema.org/draft-07/schema#
Debug
Known issues
breakingIn v5, the package switched from CommonJS to ESM. require() will not work.
fix
Use import statements or dynamic import(). If using Node <12, upgrade Node.
affects: >=5.0.0
gotchaThe schema is generated at runtime, not a static file. Ensure build() is called in a Node environment; bundlers may need configuration.
fix
For browser usage, consider using the pre-built schema from the vega package.
affects: >=0.0.1
deprecatedThe 'filename' and 'output' options were deprecated in v4 and removed in v5.
fix
Remove these options; use build() without arguments.
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'vega-schema'
Package not installed or incorrect import in a CommonJS context.
fix
Run 'npm install vega-schema' and use import (ESM) instead of require().
TypeError: build is not a function
Default import used instead of named import, but the import is correct only for default.
fix
Use 'import build from 'vega-schema'' (default import) or 'import { build } from 'vega-schema'' (named import).
SyntaxError: Unexpected token 'export'
Running the package in a CommonJS environment without transpilation.
fix
Set 'type: module' in package.json or use a bundler/transpiler.
Upgrade
Version history
6.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
16
Meta
1
OpenAI (training)
1
Resources
vega-schema — npm install vega-schema · libregistry