Skip to content

Commit aed5a6b

Browse files
committed
Switch from jsonpath to jsonpath-plus
jsonpath-plus appears to be more actively maintained, has fewer dependencies, and is a little faster. jsonpath also has known issues with Browserify.
1 parent 60b03b5 commit aed5a6b

File tree

3 files changed

+24
-38
lines changed

3 files changed

+24
-38
lines changed

lib/template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const $RefParser = require('@apidevtools/json-schema-ref-parser');
99
const url = require('url');
1010
const deepmerge = require('deepmerge');
1111
const path = require('path');
12-
const jsonpath = require('jsonpath');
12+
const JSONPath = require('jsonpath-plus').JSONPath;
1313

1414
const httpUtils = require('./http_utils');
1515

@@ -801,7 +801,7 @@ class Template {
801801
view[def] = res.body;
802802
}
803803
if (defProp.pathQuery) {
804-
const results = jsonpath.query(view[def], defProp.pathQuery, 1);
804+
const results = JSONPath(defProp.pathQuery, view[def]);
805805
view[def] = results[0];
806806
}
807807
return Promise.resolve();

package-lock.json

Lines changed: 21 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"deepmerge": "^4.2.2",
5757
"js-yaml": "^3.14.0",
5858
"json-schema-merge-allof": "^0.7.0",
59-
"jsonpath": "^1.0.2",
59+
"jsonpath-plus": "^4.0.0",
6060
"mustache": "^4.0.1",
6161
"uuid": "^7.0.3",
6262
"yargs": "^15.4.1"

0 commit comments

Comments
 (0)