Registry / devops / simple-json-schema-deref

simple-json-schema-deref

JSON →
library0.1.0jsnpmunverified

Resolves $ref pointers in JSON Schema documents by replacing them with the referenced schemas. This package (simple-json-schema-deref 0.1.0) is an early-stage library with no recent updates, last published to npm in 2015. It is a lightweight alternative to full JSON Schema processing libraries, focusing solely on dereferencing. The API is minimal: a single function that takes a schema object and returns the resolved schema. It supports Node.js, AngularJS, and browser via a global. No TypeScript types included.

npm install simple-json-schema-deref
INSTALL
IMPORT
SIG · SIMPLE-JSON-SCHEMA
S
simple-json-schema-deref
devopsjavascriptv0.1.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.

default
import jsDeref from 'json-schema-deref'
const jsDeref = require('json-schema-deref')
Package does not define a default export; in CommonJS require returns a function directly. ESM import might not work without a shim.
jsonSchemaDeref (AngularJS module)
angular.module('MyApp', ['jsonSchemaDeref'])
angular.module('MyApp', ['jsonSchemaDeref', ...]) // order not important
AngularJS module name is 'jsonSchemaDeref', service is injected as 'jsonSchemaDeref'.
global browser usage
window.JSON_SCHEMA_DEREF(schema);
var deref = window.json_schema_deref;
Global is all-caps with underscores: JSON_SCHEMA_DEREF.

Demonstrates basic dereferencing of a JSON Schema with $ref pointers in Node.js.

// Install: npm install json-schema-deref const jsDeref = require('json-schema-deref'); const schema = { type: 'object', properties: { name: { type: 'string' }, address: { $ref: '#/definitions/address' } }, definitions: { address: { type: 'object', properties: { street: { type: 'string' }, city: { type: 'string' } }, required: ['street', 'city'] } } }; const dereferenced = jsDeref(schema); console.log(JSON.stringify(dereferenced, null, 2)); // The $ref is replaced with the actual definition // Output includes the full address schema inlined.
Debug
Known issues
deprecatedPackage has not been updated since 2015; no support for draft-07 or later JSON Schema features.
fix
Consider using @apidevtools/json-schema-ref-parser or json-schema-ref-parser for modern JSON Schema support.
affects: >=0.0.0
breakingThe import style differs between environments: CommonJS, AngularJS, and browser globals have incompatible APIs.
fix
Use a bundler like webpack with a single compatible import to avoid confusion.
affects: >=0.0.0
gotchaThe package does not resolve external $ref URLs; only internal references within the schema are resolved.
fix
For external resolution, use json-schema-ref-parser.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: jsDeref is not a function
Using ES module import syntax when package exports a CommonJS module without default export.
fix
Use CommonJS require: const jsDeref = require('json-schema-deref');
Cannot find module 'json-schema-deref'
Package name is 'json-schema-deref' on npm but local directory or alternative name may be used incorrectly.
fix
npm install json-schema-deref
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
simple-json-schema-deref — npm install simple-json-schema-deref · libregistry