Gathering detailed insights and metrics for @bcherny/json-schema-ref-parser
Gathering detailed insights and metrics for @bcherny/json-schema-ref-parser
Gathering detailed insights and metrics for @bcherny/json-schema-ref-parser
Gathering detailed insights and metrics for @bcherny/json-schema-ref-parser
Parse, Resolve, and Dereference JSON Schema $ref pointers in Node and browsers
npm install @bcherny/json-schema-ref-parser
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.9
Supply Chain
99.2
Quality
75.1
Maintenance
100
Vulnerability
99.6
License
TypeScript (99.64%)
JavaScript (0.32%)
HTML (0.03%)
CSS (0.01%)
Total Downloads
34,551,336
Last Day
11,142
Last Week
325,382
Last Month
1,454,916
Last Year
15,616,315
MIT License
1,035 Stars
745 Commits
236 Forks
8 Watchers
14 Branches
51 Contributors
Updated on Jul 07, 2025
Minified
Minified + Gzipped
Latest Version
10.0.5-fork
Package Id
@bcherny/json-schema-ref-parser@10.0.5-fork
Unpacked Size
302.26 kB
Size
52.22 kB
File Count
45
NPM Version
8.19.2
Node Version
18.12.1
Published on
Feb 23, 2023
Cumulative downloads
Total Downloads
23
This package needs a new maintainer or at least some contributors. For more information please read this article. As of v10.0.0 I am no longer spending any time working on this tool, so I can focus on scaling up my reforestation charity instead of burning myself out trying to maintain a whole load of OSS projects I don't use in my vanishingly small spare time. Get in touch if you'd like to take over. - Phil Sturgeon
You've got a JSON Schema with $ref
pointers to other files and/or URLs. Maybe you know all the referenced files ahead of time. Maybe you don't. Maybe some are local files, and others are remote URLs. Maybe they are a mix of JSON and YAML format. Maybe some of the files contain cross-references to each other.
1{ 2 "definitions": { 3 "person": { 4 // references an external file 5 "$ref": "schemas/people/Bruce-Wayne.json" 6 }, 7 "place": { 8 // references a sub-schema in an external file 9 "$ref": "schemas/places.yaml#/definitions/Gotham-City" 10 }, 11 "thing": { 12 // references a URL 13 "$ref": "http://wayne-enterprises.com/things/batmobile" 14 }, 15 "color": { 16 // references a value in an external file via an internal reference 17 "$ref": "#/definitions/thing/properties/colors/black-as-the-night" 18 } 19 } 20}
JSON Schema $Ref Parser is a full JSON Reference and JSON Pointer implementation that crawls even the most complex JSON Schemas and gives you simple, straightforward JavaScript objects.
$ref
pointers to external files and URLs, as well as custom sources such as databases$ref
pointers$ref
pointers to the same value always resolve to the same object instance1$RefParser.dereference(mySchema, (err, schema) => { 2 if (err) { 3 console.error(err); 4 } 5 else { 6 // `schema` is just a normal JavaScript object that contains your entire JSON Schema, 7 // including referenced files, combined into a single object 8 console.log(schema.definitions.person.properties.firstName); 9 } 10})
Or use async
/await
syntax instead. The following example is the same as above:
1try { 2 let schema = await $RefParser.dereference(mySchema); 3 console.log(schema.definitions.person.properties.firstName); 4} 5catch(err) { 6 console.error(err); 7}
For more detailed examples, please see the API Documentation
Install using npm:
1npm install @apidevtools/json-schema-ref-parser
When using JSON Schema $Ref Parser in Node.js apps, you'll probably want to use CommonJS syntax:
1const $RefParser = require("@apidevtools/json-schema-ref-parser");
When using a transpiler such as Babel or TypeScript, or a bundler such as Webpack or Rollup, you can use ECMAScript modules syntax instead:
1import $RefParser from "@apidevtools/json-schema-ref-parser";
If you are using Node.js < 18, you'll need a polyfill for fetch
, like node-fetch:
1import fetch from "node-fetch"; 2 3globalThis.fetch = fetch;
JSON Schema $Ref Parser supports recent versions of every major web browser. Older browsers may require Babel and/or polyfills.
To use JSON Schema $Ref Parser in a browser, you'll need to use a bundling tool such as Webpack, Rollup, Parcel, or Browserify. Some bundlers may require a bit of configuration, such as setting browser: true
in rollup-plugin-resolve.
Full API documentation is available right here
I welcome any contributions, enhancements, and bug-fixes. Open an issue on GitHub and submit a pull request.
To build/test the project locally on your computer:
Clone this repo
git clone https://github.com/APIDevTools/json-schema-ref-parser.git
Install dependencies
npm install
Run the tests
npm test
JSON Schema $Ref Parser is 100% free and open-source, under the MIT license. Use it however you want.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
Thanks to these awesome companies for their support of Open Source developers ❤
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
27 commit(s) and 6 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-3.3%
11,142
Compared to previous day
Last Week
-11.3%
325,382
Compared to previous week
Last Month
-5.5%
1,454,916
Compared to previous month
Last Year
12.9%
15,616,315
Compared to previous year