json-schema-ref-parser
Advanced tools
Comparing version 7.0.1 to 7.1.0
@@ -6,6 +6,15 @@ # Change Log | ||
## [v7.1.0](https://github.com/APIDevTools/json-schema-ref-parser/tree/v7.1.0) (2019-06-21) | ||
- Merged [PR #124](https://github.com/APIDevTools/json-schema-ref-parser/pull/124/), which provides more context to [custom resolvers](https://apidevtools.org/json-schema-ref-parser/docs/plugins/resolvers.html). | ||
[Full Changelog](https://github.com/APIDevTools/json-schema-ref-parser/compare/v7.0.1...v7.1.0) | ||
## [v7.0.0](https://github.com/APIDevTools/json-schema-ref-parser/tree/v7.0.0) (2019-06-11) | ||
- Dropped support for Node 6 | ||
- Updated all code to ES6+ syntax (async/await, template literals, arrow functions, etc.) | ||
- No longer including a pre-built bundle in the package. such as [Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/), [Parcel](https://parceljs.org/), or [Browserify](http://browserify.org/) to include JSON Schema $Ref Parser in your app | ||
@@ -12,0 +21,0 @@ |
@@ -35,7 +35,7 @@ "use strict"; | ||
// Read the file and then parse the data | ||
const resolver = await readFile(file, options); | ||
const resolver = await readFile(file, options, $refs); | ||
$ref.pathType = resolver.plugin.name; | ||
file.data = resolver.result; | ||
const parser = await parseFile(file, options); | ||
const parser = await parseFile(file, options, $refs); | ||
$ref.value = parser.result; | ||
@@ -61,3 +61,3 @@ | ||
*/ | ||
function readFile (file, options) { | ||
function readFile (file, options, $refs) { | ||
return new Promise(((resolve, reject) => { | ||
@@ -72,3 +72,3 @@ // console.log('Reading %s', file.url); | ||
plugins.sort(resolvers); | ||
plugins.run(resolvers, "read", file) | ||
plugins.run(resolvers, "read", file, $refs) | ||
.then(resolve, onError); | ||
@@ -101,3 +101,3 @@ | ||
*/ | ||
function parseFile (file, options) { | ||
function parseFile (file, options, $refs) { | ||
return new Promise(((resolve, reject) => { | ||
@@ -115,3 +115,3 @@ // console.log('Parsing %s', file.url); | ||
plugins.sort(parsers); | ||
plugins.run(parsers, "parse", file) | ||
plugins.run(parsers, "parse", file, $refs) | ||
.then(onParsed, onError); | ||
@@ -118,0 +118,0 @@ |
@@ -63,3 +63,3 @@ "use strict"; | ||
*/ | ||
exports.run = function (plugins, method, file) { | ||
exports.run = function (plugins, method, file, $refs) { | ||
let plugin, lastError, index = 0; | ||
@@ -79,3 +79,3 @@ | ||
// console.log(' %s', plugin.name); | ||
let result = getResult(plugin, method, file, callback); | ||
let result = getResult(plugin, method, file, callback, $refs); | ||
if (result && typeof result.then === "function") { | ||
@@ -133,7 +133,7 @@ // A promise was returned | ||
*/ | ||
function getResult (obj, prop, file, callback) { | ||
function getResult (obj, prop, file, callback, $refs) { | ||
let value = obj[prop]; | ||
if (typeof value === "function") { | ||
return value.apply(obj, [file, callback]); | ||
return value.apply(obj, [file, callback, $refs]); | ||
} | ||
@@ -140,0 +140,0 @@ |
{ | ||
"name": "json-schema-ref-parser", | ||
"version": "7.0.1", | ||
"version": "7.1.0", | ||
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers", | ||
@@ -67,4 +67,4 @@ "keywords": [ | ||
"nyc": "^14.1.1", | ||
"typescript": "^3.5.1", | ||
"version-bump-prompt": "^5.0.2" | ||
"typescript": "^3.5.2", | ||
"version-bump-prompt": "^5.0.3" | ||
}, | ||
@@ -71,0 +71,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131757