Registry / devops / json-metaschema

json-metaschema

JSON →
library1.3.0jsnpmunverified

A repository of JSON Schema meta-schemas – the schemas that describe JSON Schema documents themselves. This package provides pre-built JSON Schema drafts (e.g., draft-04, draft-07, 2019-09, 2020-12) as reusable modules. Current stable version is 1.3.0, released on a monthly cadence. Key differentiator: it is the canonical source for meta-schemas, maintained by the JSON Schema specification authors, and includes official drafts and hyper-schemas.

npm install json-metaschema
INSTALL
IMPORT
SIG · JSON-METASCHEMA
J
json-metaschema
devopsjavascriptv1.3.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.

draft04
import { draft04 } from 'json-metaschema'
const draft04 = require('json-metaschema').draft04
ESM-only since v1.3.0. Use default or named exports.
draft07
import { draft07 } from 'json-metaschema'
import draft07 from 'json-metaschema/draft07'
All drafts are exported as named exports from the main entry.
metaSchema
import { metaSchema } from 'json-metaschema'
const metaSchema = require('json-metaschema')
metaSchema points to the latest draft version.
allSchemas
import { allSchemas } from 'json-metaschema'
import * as schemas from 'json-metaschema'
Star import returns different module shape; use named export allSchemas.

Demonstrates importing and logging four different schema exports: draft04, draft07, the latest metaSchema, and the allSchemas array.

import { draft04, draft07, metaSchema, allSchemas } from 'json-metaschema'; console.log('Draft 04 schema:', JSON.stringify(draft04, null, 2)); console.log('Draft 07 schema:', JSON.stringify(draft07, null, 2)); console.log('Latest meta-schema:', JSON.stringify(metaSchema, null, 2)); console.log('All schemas count:', allSchemas.length);
Debug
Known issues
breakingThe import path structure changed in v1.3.0 from deep imports (e.g., 'json-metaschema/draft-04') to named exports from the main package entry.
fix
Update imports to use named exports: import { draft04 } from 'json-metaschema'
affects: <1.3.0
gotchaThe allSchemas array may include duplicate schemas when there are multiple versions of the same draft (e.g., with and without hyper-schema).
fix
Filter duplicates manually or use individual named exports.
affects: >=1.0.0
deprecatedDirect require of subpath modules like require('json-metaschema/draft-04') is deprecated in v1.3.0 due to ESM-only exports.
fix
Use import syntax or import from the main entry.
affects: >=1.3.0
gotchaThe package is ESM-only since v1.3.0; it cannot be require()'d in CommonJS without async import.
fix
Use dynamic import() inside CommonJS or switch to ESM module.
affects: >=1.3.0
breakingExport for draft-06 was removed in v1.2.0 as JSON Schema draft-06 meta-schema is no longer maintained.
fix
Use draft-07 instead.
affects: >=1.2.0
Errors
Common errors & fixes
Cannot find module 'json-metaschema' or its corresponding type declarations.
TypeScript does not recognize module due to missing types in <1.3.0.
fix
Install @types/json-metaschema or upgrade to >=1.3.0 which includes built-in types.
ERR_REQUIRE_ESM: require() of ES Module not supported.
CommonJS require() on ESM-only package since v1.3.0.
fix
Use import() or switch to ESM: 'type': 'module' in package.json.
Module 'json-metaschema' has no exported member 'draft-04'.
Import path uses hyphen instead of camelCase draft04.
fix
Use 'draft04' (camelCase) as exported name.
The requested module 'json-metaschema/draft-04' does not provide an export named 'default'.
Deep import paths removed in v1.3.0.
fix
Use import { draft04 } from 'json-metaschema' instead.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
json-metaschema — npm install json-metaschema · libregistry