@apidevtools/json-schema-ref-parser 11.1.1 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/bundle.js +11 -11
- package/dist/lib/dereference.js +1 -1
- package/dist/lib/options.d.ts +5 -3
- package/dist/lib/options.js +2 -1
- package/dist/lib/parsers/yaml.js +1 -1
- package/dist/lib/resolvers/http.js +1 -1
- package/lib/dereference.ts +1 -1
- package/lib/options.ts +7 -4
- package/package.json +24 -22
package/dist/lib/bundle.js
CHANGED
|
@@ -136,17 +136,17 @@ function inventory$Ref($refParent, $refKey, path, pathFromRoot, indirections, in
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
inventory.push({
|
|
139
|
-
$ref,
|
|
140
|
-
parent: $refParent,
|
|
141
|
-
key: $refKey,
|
|
142
|
-
pathFromRoot,
|
|
143
|
-
depth,
|
|
144
|
-
file,
|
|
145
|
-
hash,
|
|
146
|
-
value: pointer.value,
|
|
147
|
-
circular: pointer.circular,
|
|
148
|
-
extended,
|
|
149
|
-
external,
|
|
139
|
+
$ref, // The JSON Reference (e.g. {$ref: string})
|
|
140
|
+
parent: $refParent, // The object that contains this $ref pointer
|
|
141
|
+
key: $refKey, // The key in `parent` that is the $ref pointer
|
|
142
|
+
pathFromRoot, // The path to the $ref pointer, from the JSON Schema root
|
|
143
|
+
depth, // How far from the JSON Schema root is this $ref pointer?
|
|
144
|
+
file, // The file that the $ref pointer resolves to
|
|
145
|
+
hash, // The hash within `file` that the $ref pointer resolves to
|
|
146
|
+
value: pointer.value, // The resolved value of the $ref pointer
|
|
147
|
+
circular: pointer.circular, // Is this $ref pointer DIRECTLY circular? (i.e. it references itself)
|
|
148
|
+
extended, // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to "$ref")
|
|
149
|
+
external, // Does this $ref pointer point to a file other than the main JSON Schema file?
|
|
150
150
|
indirections, // The number of indirect references that were traversed to resolve the value
|
|
151
151
|
});
|
|
152
152
|
// Recursively crawl the resolved value
|
package/dist/lib/dereference.js
CHANGED
|
@@ -89,7 +89,7 @@ function crawl(obj, path, pathFromRoot, parents, processedObjects, dereferencedC
|
|
|
89
89
|
if (obj[key] !== dereferenced.value) {
|
|
90
90
|
obj[key] = dereferenced.value;
|
|
91
91
|
if (options.dereference.onDereference) {
|
|
92
|
-
options.dereference.onDereference(value.$ref, obj[key]);
|
|
92
|
+
options.dereference.onDereference(value.$ref, obj[key], obj, key);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
package/dist/lib/options.d.ts
CHANGED
|
@@ -65,10 +65,12 @@ interface $RefParserOptions {
|
|
|
65
65
|
/**
|
|
66
66
|
* Callback invoked during dereferencing.
|
|
67
67
|
*
|
|
68
|
-
* @argument {string} path The path being dereferenced (ie. the `$ref` string)
|
|
69
|
-
* @argument {JSONSchemaObject}
|
|
68
|
+
* @argument {string} path - The path being dereferenced (ie. the `$ref` string)
|
|
69
|
+
* @argument {JSONSchemaObject} value - The JSON-Schema that the `$ref` resolved to
|
|
70
|
+
* @argument {JSONSchemaObject} parent - The parent of the dereferenced object
|
|
71
|
+
* @argument {string} parentPropName - The prop name of the parent object whose value was dereferenced
|
|
70
72
|
*/
|
|
71
|
-
onDereference?(path: string, value: JSONSchemaObject): void;
|
|
73
|
+
onDereference?(path: string, value: JSONSchemaObject, parent?: JSONSchemaObject, parentPropName?: string): void;
|
|
72
74
|
/**
|
|
73
75
|
* Whether a reference should resolve relative to its directory/path, or from the cwd
|
|
74
76
|
*
|
package/dist/lib/options.js
CHANGED
|
@@ -91,7 +91,8 @@ exports.getNewOptions = getNewOptions;
|
|
|
91
91
|
*/
|
|
92
92
|
function merge(target, source) {
|
|
93
93
|
if (isMergeable(source)) {
|
|
94
|
-
|
|
94
|
+
// prevent prototype pollution
|
|
95
|
+
const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
|
|
95
96
|
for (let i = 0; i < keys.length; i++) {
|
|
96
97
|
const key = keys[i];
|
|
97
98
|
const sourceSetting = source[key];
|
package/dist/lib/parsers/yaml.js
CHANGED
|
@@ -21,7 +21,7 @@ exports.default = {
|
|
|
21
21
|
* Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case
|
|
22
22
|
* every parser will be tried.
|
|
23
23
|
*/
|
|
24
|
-
canParse: [".yaml", ".yml", ".json"],
|
|
24
|
+
canParse: [".yaml", ".yml", ".json"], // JSON is valid YAML
|
|
25
25
|
/**
|
|
26
26
|
* Parses the given file as YAML
|
|
27
27
|
*
|
package/lib/dereference.ts
CHANGED
|
@@ -107,7 +107,7 @@ function crawl(
|
|
|
107
107
|
if (obj[key] !== dereferenced.value) {
|
|
108
108
|
obj[key] = dereferenced.value;
|
|
109
109
|
if (options.dereference.onDereference) {
|
|
110
|
-
options.dereference.onDereference(value.$ref, obj[key]);
|
|
110
|
+
options.dereference.onDereference(value.$ref, obj[key], obj, key);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
} else {
|
package/lib/options.ts
CHANGED
|
@@ -79,10 +79,12 @@ interface $RefParserOptions {
|
|
|
79
79
|
/**
|
|
80
80
|
* Callback invoked during dereferencing.
|
|
81
81
|
*
|
|
82
|
-
* @argument {string} path The path being dereferenced (ie. the `$ref` string)
|
|
83
|
-
* @argument {JSONSchemaObject}
|
|
82
|
+
* @argument {string} path - The path being dereferenced (ie. the `$ref` string)
|
|
83
|
+
* @argument {JSONSchemaObject} value - The JSON-Schema that the `$ref` resolved to
|
|
84
|
+
* @argument {JSONSchemaObject} parent - The parent of the dereferenced object
|
|
85
|
+
* @argument {string} parentPropName - The prop name of the parent object whose value was dereferenced
|
|
84
86
|
*/
|
|
85
|
-
onDereference?(path: string, value: JSONSchemaObject): void;
|
|
87
|
+
onDereference?(path: string, value: JSONSchemaObject, parent?: JSONSchemaObject, parentPropName?: string): void;
|
|
86
88
|
|
|
87
89
|
/**
|
|
88
90
|
* Whether a reference should resolve relative to its directory/path, or from the cwd
|
|
@@ -180,7 +182,8 @@ export type ParserOptions = DeepPartial<$RefParserOptions>;
|
|
|
180
182
|
*/
|
|
181
183
|
function merge(target: any, source: any) {
|
|
182
184
|
if (isMergeable(source)) {
|
|
183
|
-
|
|
185
|
+
// prevent prototype pollution
|
|
186
|
+
const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
|
|
184
187
|
for (let i = 0; i < keys.length; i++) {
|
|
185
188
|
const key = keys[i];
|
|
186
189
|
const sourceSetting = source[key];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apidevtools/json-schema-ref-parser",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"scripts": {
|
|
58
58
|
"prepublishOnly": "yarn build",
|
|
59
59
|
"lint": "eslint lib",
|
|
60
|
-
"build": "
|
|
60
|
+
"build": "rimraf dist && tsc",
|
|
61
61
|
"typecheck": "tsc --noEmit",
|
|
62
62
|
"prettier": "prettier --write \"**/*.+(js|jsx|ts|tsx|har||json|css|md)\"",
|
|
63
63
|
"test": "vitest --coverage",
|
|
@@ -67,33 +67,34 @@
|
|
|
67
67
|
"test:watch": "vitest -w"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@types/eslint": "8.
|
|
71
|
-
"@types/js-yaml": "^4.0.
|
|
72
|
-
"@types/node": "^20.
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
74
|
-
"@typescript-eslint/eslint-plugin-tslint": "^
|
|
75
|
-
"@typescript-eslint/parser": "^
|
|
76
|
-
"@vitest/coverage-v8": "^
|
|
70
|
+
"@types/eslint": "8.56.5",
|
|
71
|
+
"@types/js-yaml": "^4.0.9",
|
|
72
|
+
"@types/node": "^20.11.24",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
74
|
+
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
|
|
75
|
+
"@typescript-eslint/parser": "^7.1.1",
|
|
76
|
+
"@vitest/coverage-v8": "^1.3.1",
|
|
77
77
|
"abortcontroller-polyfill": "^1.7.5",
|
|
78
78
|
"cross-env": "^7.0.3",
|
|
79
|
-
"eslint": "^8.
|
|
80
|
-
"eslint-config-prettier": "^9.
|
|
79
|
+
"eslint": "^8.57.0",
|
|
80
|
+
"eslint-config-prettier": "^9.1.0",
|
|
81
81
|
"eslint-config-standard": "^17.1.0",
|
|
82
|
-
"eslint-plugin-import": "^2.
|
|
83
|
-
"eslint-plugin-prettier": "^5.
|
|
82
|
+
"eslint-plugin-import": "^2.29.1",
|
|
83
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
84
84
|
"eslint-plugin-promise": "^6.1.1",
|
|
85
|
-
"eslint-plugin-unused-imports": "^3.
|
|
86
|
-
"jsdom": "^
|
|
87
|
-
"lint-staged": "^
|
|
85
|
+
"eslint-plugin-unused-imports": "^3.1.0",
|
|
86
|
+
"jsdom": "^24.0.0",
|
|
87
|
+
"lint-staged": "^15.2.2",
|
|
88
88
|
"node-fetch": "^3.3.2",
|
|
89
|
-
"prettier": "^3.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
89
|
+
"prettier": "^3.2.5",
|
|
90
|
+
"rimraf": "^5.0.5",
|
|
91
|
+
"typescript": "^5.3.3",
|
|
92
|
+
"vitest": "^1.3.1"
|
|
92
93
|
},
|
|
93
94
|
"dependencies": {
|
|
94
95
|
"@jsdevtools/ono": "^7.1.3",
|
|
95
|
-
"@types/json-schema": "^7.0.
|
|
96
|
-
"@types/lodash.clonedeep": "^4.5.
|
|
96
|
+
"@types/json-schema": "^7.0.15",
|
|
97
|
+
"@types/lodash.clonedeep": "^4.5.9",
|
|
97
98
|
"js-yaml": "^4.1.0",
|
|
98
99
|
"lodash.clonedeep": "^4.5.0"
|
|
99
100
|
},
|
|
@@ -107,5 +108,6 @@
|
|
|
107
108
|
"@semantic-release/npm",
|
|
108
109
|
"@semantic-release/github"
|
|
109
110
|
]
|
|
110
|
-
}
|
|
111
|
+
},
|
|
112
|
+
"packageManager": "yarn@4.1.1"
|
|
111
113
|
}
|