@apidevtools/json-schema-ref-parser 11.2.0 → 11.2.2
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/normalize-args.d.ts +1 -1
- package/dist/lib/normalize-args.js +6 -1
- package/dist/lib/options.js +7 -8
- package/dist/lib/parsers/yaml.js +0 -1
- package/dist/lib/resolvers/http.js +0 -9
- package/dist/vite.config.js +0 -1
- package/lib/normalize-args.ts +5 -1
- package/lib/options.ts +7 -8
- package/lib/parsers/yaml.ts +0 -1
- package/lib/resolvers/http.ts +0 -9
- package/package.json +3 -9
|
@@ -32,7 +32,12 @@ function normalizeArgs(_args) {
|
|
|
32
32
|
schema = args[0];
|
|
33
33
|
options = args[1];
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
try {
|
|
36
|
+
options = (0, options_js_1.getNewOptions)(options);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
console.log(e);
|
|
40
|
+
}
|
|
36
41
|
return {
|
|
37
42
|
path,
|
|
38
43
|
schema,
|
package/dist/lib/options.js
CHANGED
|
@@ -10,7 +10,6 @@ const text_js_1 = __importDefault(require("./parsers/text.js"));
|
|
|
10
10
|
const binary_js_1 = __importDefault(require("./parsers/binary.js"));
|
|
11
11
|
const file_js_1 = __importDefault(require("./resolvers/file.js"));
|
|
12
12
|
const http_js_1 = __importDefault(require("./resolvers/http.js"));
|
|
13
|
-
const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep"));
|
|
14
13
|
const getDefaults = () => {
|
|
15
14
|
const defaults = {
|
|
16
15
|
/**
|
|
@@ -20,10 +19,10 @@ const getDefaults = () => {
|
|
|
20
19
|
* your own implementation, or disable any parser by setting it to false.
|
|
21
20
|
*/
|
|
22
21
|
parse: {
|
|
23
|
-
json: json_js_1.default,
|
|
24
|
-
yaml: yaml_js_1.default,
|
|
25
|
-
text: text_js_1.default,
|
|
26
|
-
binary: binary_js_1.default,
|
|
22
|
+
json: { ...json_js_1.default },
|
|
23
|
+
yaml: { ...yaml_js_1.default },
|
|
24
|
+
text: { ...text_js_1.default },
|
|
25
|
+
binary: { ...binary_js_1.default },
|
|
27
26
|
},
|
|
28
27
|
/**
|
|
29
28
|
* Determines how JSON References will be resolved.
|
|
@@ -32,8 +31,8 @@ const getDefaults = () => {
|
|
|
32
31
|
* your own implementation, or disable any resolver by setting it to false.
|
|
33
32
|
*/
|
|
34
33
|
resolve: {
|
|
35
|
-
file: file_js_1.default,
|
|
36
|
-
http: http_js_1.default,
|
|
34
|
+
file: { ...file_js_1.default },
|
|
35
|
+
http: { ...http_js_1.default },
|
|
37
36
|
/**
|
|
38
37
|
* Determines whether external $ref pointers will be resolved.
|
|
39
38
|
* If this option is disabled, then none of above resolvers will be called.
|
|
@@ -72,7 +71,7 @@ const getDefaults = () => {
|
|
|
72
71
|
referenceResolution: "relative",
|
|
73
72
|
},
|
|
74
73
|
};
|
|
75
|
-
return
|
|
74
|
+
return defaults;
|
|
76
75
|
};
|
|
77
76
|
const getNewOptions = (options) => {
|
|
78
77
|
const newOptions = getDefaults();
|
package/dist/lib/parsers/yaml.js
CHANGED
|
@@ -124,15 +124,6 @@ async function get(u, httpOptions) {
|
|
|
124
124
|
controller = new AbortController();
|
|
125
125
|
timeoutId = setTimeout(() => controller.abort(), httpOptions.timeout);
|
|
126
126
|
}
|
|
127
|
-
if (!global.fetch) {
|
|
128
|
-
const { default: fetch, Request, Headers } = await Promise.resolve().then(() => __importStar(require("node-fetch")));
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
global.fetch = fetch;
|
|
131
|
-
// @ts-ignore
|
|
132
|
-
global.Request = Request;
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
global.Headers = Headers;
|
|
135
|
-
}
|
|
136
127
|
const response = await fetch(u, {
|
|
137
128
|
method: "GET",
|
|
138
129
|
headers: httpOptions.headers || {},
|
package/dist/vite.config.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.default = (0, config_1.defineConfig)({
|
|
|
9
9
|
exclude: ["**/__IGNORED__/**"],
|
|
10
10
|
watch: false,
|
|
11
11
|
globalSetup: isBrowser ? ["./test/fixtures/server.ts"] : undefined,
|
|
12
|
-
setupFiles: isBrowser ? ["./test/fixtures/polyfill.ts"] : undefined,
|
|
13
12
|
testTimeout: 5000,
|
|
14
13
|
globals: true,
|
|
15
14
|
passWithNoTests: true,
|
package/lib/normalize-args.ts
CHANGED
package/lib/options.ts
CHANGED
|
@@ -4,7 +4,6 @@ import textParser from "./parsers/text.js";
|
|
|
4
4
|
import binaryParser from "./parsers/binary.js";
|
|
5
5
|
import fileResolver from "./resolvers/file.js";
|
|
6
6
|
import httpResolver from "./resolvers/http.js";
|
|
7
|
-
import cloneDeep from "lodash.clonedeep";
|
|
8
7
|
|
|
9
8
|
import type { HTTPResolverOptions, JSONSchemaObject, Plugin, ResolverOptions } from "./types/index.js";
|
|
10
9
|
|
|
@@ -104,10 +103,10 @@ const getDefaults = () => {
|
|
|
104
103
|
* your own implementation, or disable any parser by setting it to false.
|
|
105
104
|
*/
|
|
106
105
|
parse: {
|
|
107
|
-
json: jsonParser,
|
|
108
|
-
yaml: yamlParser,
|
|
109
|
-
text: textParser,
|
|
110
|
-
binary: binaryParser,
|
|
106
|
+
json: { ...jsonParser },
|
|
107
|
+
yaml: { ...yamlParser },
|
|
108
|
+
text: { ...textParser },
|
|
109
|
+
binary: { ...binaryParser },
|
|
111
110
|
},
|
|
112
111
|
|
|
113
112
|
/**
|
|
@@ -117,8 +116,8 @@ const getDefaults = () => {
|
|
|
117
116
|
* your own implementation, or disable any resolver by setting it to false.
|
|
118
117
|
*/
|
|
119
118
|
resolve: {
|
|
120
|
-
file: fileResolver,
|
|
121
|
-
http: httpResolver,
|
|
119
|
+
file: { ...fileResolver },
|
|
120
|
+
http: { ...httpResolver },
|
|
122
121
|
|
|
123
122
|
/**
|
|
124
123
|
* Determines whether external $ref pointers will be resolved.
|
|
@@ -161,7 +160,7 @@ const getDefaults = () => {
|
|
|
161
160
|
referenceResolution: "relative",
|
|
162
161
|
},
|
|
163
162
|
} as $RefParserOptions;
|
|
164
|
-
return
|
|
163
|
+
return defaults;
|
|
165
164
|
};
|
|
166
165
|
|
|
167
166
|
export const getNewOptions = (options: DeepPartial<$RefParserOptions>): $RefParserOptions => {
|
package/lib/parsers/yaml.ts
CHANGED
package/lib/resolvers/http.ts
CHANGED
|
@@ -113,15 +113,6 @@ async function get(u: RequestInfo | URL, httpOptions: HTTPResolverOptions) {
|
|
|
113
113
|
timeoutId = setTimeout(() => controller.abort(), httpOptions.timeout);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
if (!global.fetch) {
|
|
117
|
-
const { default: fetch, Request, Headers } = await import("node-fetch");
|
|
118
|
-
// @ts-ignore
|
|
119
|
-
global.fetch = fetch;
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
global.Request = Request;
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
global.Headers = Headers;
|
|
124
|
-
}
|
|
125
116
|
const response = await fetch(u, {
|
|
126
117
|
method: "GET",
|
|
127
118
|
headers: httpOptions.headers || {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apidevtools/json-schema-ref-parser",
|
|
3
|
-
"version": "11.2.
|
|
3
|
+
"version": "11.2.2",
|
|
4
4
|
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"json",
|
|
@@ -69,12 +69,10 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/eslint": "8.56.5",
|
|
71
71
|
"@types/js-yaml": "^4.0.9",
|
|
72
|
-
"@types/node": "^
|
|
72
|
+
"@types/node": "^18.19.21",
|
|
73
73
|
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
74
|
-
"@typescript-eslint/eslint-plugin-tslint": "^7.0.2",
|
|
75
74
|
"@typescript-eslint/parser": "^7.1.1",
|
|
76
75
|
"@vitest/coverage-v8": "^1.3.1",
|
|
77
|
-
"abortcontroller-polyfill": "^1.7.5",
|
|
78
76
|
"cross-env": "^7.0.3",
|
|
79
77
|
"eslint": "^8.57.0",
|
|
80
78
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -84,8 +82,6 @@
|
|
|
84
82
|
"eslint-plugin-promise": "^6.1.1",
|
|
85
83
|
"eslint-plugin-unused-imports": "^3.1.0",
|
|
86
84
|
"jsdom": "^24.0.0",
|
|
87
|
-
"lint-staged": "^15.2.2",
|
|
88
|
-
"node-fetch": "^3.3.2",
|
|
89
85
|
"prettier": "^3.2.5",
|
|
90
86
|
"rimraf": "^5.0.5",
|
|
91
87
|
"typescript": "^5.3.3",
|
|
@@ -94,9 +90,7 @@
|
|
|
94
90
|
"dependencies": {
|
|
95
91
|
"@jsdevtools/ono": "^7.1.3",
|
|
96
92
|
"@types/json-schema": "^7.0.15",
|
|
97
|
-
"
|
|
98
|
-
"js-yaml": "^4.1.0",
|
|
99
|
-
"lodash.clonedeep": "^4.5.0"
|
|
93
|
+
"js-yaml": "^4.1.0"
|
|
100
94
|
},
|
|
101
95
|
"release": {
|
|
102
96
|
"branches": [
|