@apidevtools/json-schema-ref-parser 13.0.4 → 13.0.5
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/index.d.ts +6 -6
- package/dist/lib/refs.d.ts +5 -5
- package/dist/lib/refs.js +4 -4
- package/dist/lib/types/index.d.ts +3 -3
- package/lib/index.ts +6 -6
- package/lib/refs.ts +5 -5
- package/lib/types/index.ts +3 -3
- package/package.json +8 -8
package/dist/lib/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
55
55
|
*
|
|
56
56
|
* Resolves all JSON references (`$ref` pointers) in the given JSON Schema file. If it references any other files/URLs, then they will be downloaded and resolved as well. This method **does not** dereference anything. It simply gives you a `$Refs` object, which is a map of all the resolved references and their values.
|
|
57
57
|
*
|
|
58
|
-
* See https://
|
|
58
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#resolveschema-options-callback
|
|
59
59
|
*
|
|
60
60
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
61
61
|
* @param options (optional)
|
|
@@ -72,7 +72,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
72
72
|
*
|
|
73
73
|
* Resolves all JSON references (`$ref` pointers) in the given JSON Schema file. If it references any other files/URLs, then they will be downloaded and resolved as well. This method **does not** dereference anything. It simply gives you a `$Refs` object, which is a map of all the resolved references and their values.
|
|
74
74
|
*
|
|
75
|
-
* See https://
|
|
75
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#resolveschema-options-callback
|
|
76
76
|
*
|
|
77
77
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
78
78
|
* @param options (optional)
|
|
@@ -89,7 +89,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
89
89
|
*
|
|
90
90
|
* This also eliminates the risk of circular references, so the schema can be safely serialized using `JSON.stringify()`.
|
|
91
91
|
*
|
|
92
|
-
* See https://
|
|
92
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#bundleschema-options-callback
|
|
93
93
|
*
|
|
94
94
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
95
95
|
* @param options (optional)
|
|
@@ -106,7 +106,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
106
106
|
*
|
|
107
107
|
* This also eliminates the risk of circular references, so the schema can be safely serialized using `JSON.stringify()`.
|
|
108
108
|
*
|
|
109
|
-
* See https://
|
|
109
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#bundleschema-options-callback
|
|
110
110
|
*
|
|
111
111
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
112
112
|
* @param options (optional)
|
|
@@ -123,7 +123,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
123
123
|
*
|
|
124
124
|
* The dereference method maintains object reference equality, meaning that all `$ref` pointers that point to the same object will be replaced with references to the same object. Again, this is great for programmatic usage, but it does introduce the risk of circular references, so be careful if you intend to serialize the schema using `JSON.stringify()`. Consider using the bundle method instead, which does not create circular references.
|
|
125
125
|
*
|
|
126
|
-
* See https://
|
|
126
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#dereferenceschema-options-callback
|
|
127
127
|
*
|
|
128
128
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
129
129
|
* @param options (optional)
|
|
@@ -140,7 +140,7 @@ export declare class $RefParser<S extends object = JSONSchema, O extends ParserO
|
|
|
140
140
|
*
|
|
141
141
|
* The dereference method maintains object reference equality, meaning that all `$ref` pointers that point to the same object will be replaced with references to the same object. Again, this is great for programmatic usage, but it does introduce the risk of circular references, so be careful if you intend to serialize the schema using `JSON.stringify()`. Consider using the bundle method instead, which does not create circular references.
|
|
142
142
|
*
|
|
143
|
-
* See https://
|
|
143
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#dereferenceschema-options-callback
|
|
144
144
|
*
|
|
145
145
|
* @param path
|
|
146
146
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
package/dist/lib/refs.d.ts
CHANGED
|
@@ -10,19 +10,19 @@ interface $RefsMap<S extends object = JSONSchema, O extends ParserOptions<S> = P
|
|
|
10
10
|
*
|
|
11
11
|
* This object is a map of JSON References and their resolved values. It also has several convenient helper methods that make it easy for you to navigate and manipulate the JSON References.
|
|
12
12
|
*
|
|
13
|
-
* See https://
|
|
13
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
|
|
14
14
|
*/
|
|
15
15
|
export default class $Refs<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
|
|
16
16
|
/**
|
|
17
17
|
* This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.
|
|
18
18
|
*
|
|
19
|
-
* See https://
|
|
19
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
|
|
20
20
|
*/
|
|
21
21
|
circular: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* Returns the paths/URLs of all the files in your schema (including the main schema file).
|
|
24
24
|
*
|
|
25
|
-
* See https://
|
|
25
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
|
|
26
26
|
*
|
|
27
27
|
* @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
|
|
28
28
|
*/
|
|
@@ -30,7 +30,7 @@ export default class $Refs<S extends object = JSONSchema, O extends ParserOption
|
|
|
30
30
|
/**
|
|
31
31
|
* Returns a map of paths/URLs and their correspond values.
|
|
32
32
|
*
|
|
33
|
-
* See https://
|
|
33
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
|
|
34
34
|
*
|
|
35
35
|
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
|
|
36
36
|
*/
|
|
@@ -38,7 +38,7 @@ export default class $Refs<S extends object = JSONSchema, O extends ParserOption
|
|
|
38
38
|
/**
|
|
39
39
|
* Returns `true` if the given path exists in the schema; otherwise, returns `false`
|
|
40
40
|
*
|
|
41
|
-
* See https://
|
|
41
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
|
|
42
42
|
*
|
|
43
43
|
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
44
44
|
*/
|
package/dist/lib/refs.js
CHANGED
|
@@ -44,13 +44,13 @@ const convert_path_to_posix_1 = __importDefault(require("./util/convert-path-to-
|
|
|
44
44
|
*
|
|
45
45
|
* This object is a map of JSON References and their resolved values. It also has several convenient helper methods that make it easy for you to navigate and manipulate the JSON References.
|
|
46
46
|
*
|
|
47
|
-
* See https://
|
|
47
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
|
|
48
48
|
*/
|
|
49
49
|
class $Refs {
|
|
50
50
|
/**
|
|
51
51
|
* Returns the paths/URLs of all the files in your schema (including the main schema file).
|
|
52
52
|
*
|
|
53
|
-
* See https://
|
|
53
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
|
|
54
54
|
*
|
|
55
55
|
* @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
|
|
56
56
|
*/
|
|
@@ -63,7 +63,7 @@ class $Refs {
|
|
|
63
63
|
/**
|
|
64
64
|
* Returns a map of paths/URLs and their correspond values.
|
|
65
65
|
*
|
|
66
|
-
* See https://
|
|
66
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
|
|
67
67
|
*
|
|
68
68
|
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
|
|
69
69
|
*/
|
|
@@ -78,7 +78,7 @@ class $Refs {
|
|
|
78
78
|
/**
|
|
79
79
|
* Returns `true` if the given path exists in the schema; otherwise, returns `false`
|
|
80
80
|
*
|
|
81
|
-
* See https://
|
|
81
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
|
|
82
82
|
*
|
|
83
83
|
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
84
84
|
*/
|
|
@@ -6,7 +6,7 @@ export type JSONSchemaObject = JSONSchema4Object | JSONSchema6Object | JSONSchem
|
|
|
6
6
|
export type SchemaCallback<S extends object = JSONSchema> = (err: Error | null, schema?: S | object | null) => any;
|
|
7
7
|
export type $RefsCallback<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> = (err: Error | null, $refs?: $Refs<S, O>) => any;
|
|
8
8
|
/**
|
|
9
|
-
* See https://
|
|
9
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/options.html
|
|
10
10
|
*/
|
|
11
11
|
export interface HTTPResolverOptions<S extends object = JSONSchema> extends Partial<ResolverOptions<S>> {
|
|
12
12
|
/**
|
|
@@ -29,7 +29,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
|
|
|
29
29
|
/**
|
|
30
30
|
* JSON Schema `$Ref` Parser comes with built-in resolvers for HTTP and HTTPS URLs, as well as local filesystem paths (when running in Node.js). You can add your own custom resolvers to support additional protocols, or even replace any of the built-in resolvers with your own custom implementation.
|
|
31
31
|
*
|
|
32
|
-
* See https://
|
|
32
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/resolvers.html
|
|
33
33
|
*/
|
|
34
34
|
export interface ResolverOptions<S extends object = JSONSchema> {
|
|
35
35
|
name?: string;
|
|
@@ -92,7 +92,7 @@ export interface Plugin {
|
|
|
92
92
|
*
|
|
93
93
|
* The file info object currently only consists of a few properties, but it may grow in the future if plug-ins end up needing more information.
|
|
94
94
|
*
|
|
95
|
-
* See https://
|
|
95
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/file-info-object.html
|
|
96
96
|
*/
|
|
97
97
|
export interface FileInfo {
|
|
98
98
|
/**
|
package/lib/index.ts
CHANGED
|
@@ -180,7 +180,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
180
180
|
*
|
|
181
181
|
* Resolves all JSON references (`$ref` pointers) in the given JSON Schema file. If it references any other files/URLs, then they will be downloaded and resolved as well. This method **does not** dereference anything. It simply gives you a `$Refs` object, which is a map of all the resolved references and their values.
|
|
182
182
|
*
|
|
183
|
-
* See https://
|
|
183
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#resolveschema-options-callback
|
|
184
184
|
*
|
|
185
185
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
186
186
|
* @param options (optional)
|
|
@@ -210,7 +210,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
210
210
|
*
|
|
211
211
|
* Resolves all JSON references (`$ref` pointers) in the given JSON Schema file. If it references any other files/URLs, then they will be downloaded and resolved as well. This method **does not** dereference anything. It simply gives you a `$Refs` object, which is a map of all the resolved references and their values.
|
|
212
212
|
*
|
|
213
|
-
* See https://
|
|
213
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#resolveschema-options-callback
|
|
214
214
|
*
|
|
215
215
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
216
216
|
* @param options (optional)
|
|
@@ -255,7 +255,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
255
255
|
*
|
|
256
256
|
* This also eliminates the risk of circular references, so the schema can be safely serialized using `JSON.stringify()`.
|
|
257
257
|
*
|
|
258
|
-
* See https://
|
|
258
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#bundleschema-options-callback
|
|
259
259
|
*
|
|
260
260
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
261
261
|
* @param options (optional)
|
|
@@ -298,7 +298,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
298
298
|
*
|
|
299
299
|
* This also eliminates the risk of circular references, so the schema can be safely serialized using `JSON.stringify()`.
|
|
300
300
|
*
|
|
301
|
-
* See https://
|
|
301
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#bundleschema-options-callback
|
|
302
302
|
*
|
|
303
303
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
304
304
|
* @param options (optional)
|
|
@@ -327,7 +327,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
327
327
|
*
|
|
328
328
|
* The dereference method maintains object reference equality, meaning that all `$ref` pointers that point to the same object will be replaced with references to the same object. Again, this is great for programmatic usage, but it does introduce the risk of circular references, so be careful if you intend to serialize the schema using `JSON.stringify()`. Consider using the bundle method instead, which does not create circular references.
|
|
329
329
|
*
|
|
330
|
-
* See https://
|
|
330
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#dereferenceschema-options-callback
|
|
331
331
|
*
|
|
332
332
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
|
333
333
|
* @param options (optional)
|
|
@@ -370,7 +370,7 @@ export class $RefParser<S extends object = JSONSchema, O extends ParserOptions<S
|
|
|
370
370
|
*
|
|
371
371
|
* The dereference method maintains object reference equality, meaning that all `$ref` pointers that point to the same object will be replaced with references to the same object. Again, this is great for programmatic usage, but it does introduce the risk of circular references, so be careful if you intend to serialize the schema using `JSON.stringify()`. Consider using the bundle method instead, which does not create circular references.
|
|
372
372
|
*
|
|
373
|
-
* See https://
|
|
373
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/ref-parser.html#dereferenceschema-options-callback
|
|
374
374
|
*
|
|
375
375
|
* @param path
|
|
376
376
|
* @param schema A JSON Schema object, or the file path or URL of a JSON Schema file. See the `parse` method for more info.
|
package/lib/refs.ts
CHANGED
|
@@ -13,20 +13,20 @@ interface $RefsMap<S extends object = JSONSchema, O extends ParserOptions<S> = P
|
|
|
13
13
|
*
|
|
14
14
|
* This object is a map of JSON References and their resolved values. It also has several convenient helper methods that make it easy for you to navigate and manipulate the JSON References.
|
|
15
15
|
*
|
|
16
|
-
* See https://
|
|
16
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html
|
|
17
17
|
*/
|
|
18
18
|
export default class $Refs<S extends object = JSONSchema, O extends ParserOptions<S> = ParserOptions<S>> {
|
|
19
19
|
/**
|
|
20
20
|
* This property is true if the schema contains any circular references. You may want to check this property before serializing the dereferenced schema as JSON, since JSON.stringify() does not support circular references by default.
|
|
21
21
|
*
|
|
22
|
-
* See https://
|
|
22
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#circular
|
|
23
23
|
*/
|
|
24
24
|
public circular: boolean;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Returns the paths/URLs of all the files in your schema (including the main schema file).
|
|
28
28
|
*
|
|
29
|
-
* See https://
|
|
29
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
|
|
30
30
|
*
|
|
31
31
|
* @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
|
|
32
32
|
*/
|
|
@@ -40,7 +40,7 @@ export default class $Refs<S extends object = JSONSchema, O extends ParserOption
|
|
|
40
40
|
/**
|
|
41
41
|
* Returns a map of paths/URLs and their correspond values.
|
|
42
42
|
*
|
|
43
|
-
* See https://
|
|
43
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
|
|
44
44
|
*
|
|
45
45
|
* @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
|
|
46
46
|
*/
|
|
@@ -56,7 +56,7 @@ export default class $Refs<S extends object = JSONSchema, O extends ParserOption
|
|
|
56
56
|
/**
|
|
57
57
|
* Returns `true` if the given path exists in the schema; otherwise, returns `false`
|
|
58
58
|
*
|
|
59
|
-
* See https://
|
|
59
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
|
|
60
60
|
*
|
|
61
61
|
* @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
|
|
62
62
|
*/
|
package/lib/types/index.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type $RefsCallback<S extends object = JSONSchema, O extends ParserOptions
|
|
|
18
18
|
) => any;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* See https://
|
|
21
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/options.html
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
export interface HTTPResolverOptions<S extends object = JSONSchema> extends Partial<ResolverOptions<S>> {
|
|
@@ -46,7 +46,7 @@ export interface HTTPResolverOptions<S extends object = JSONSchema> extends Part
|
|
|
46
46
|
/**
|
|
47
47
|
* JSON Schema `$Ref` Parser comes with built-in resolvers for HTTP and HTTPS URLs, as well as local filesystem paths (when running in Node.js). You can add your own custom resolvers to support additional protocols, or even replace any of the built-in resolvers with your own custom implementation.
|
|
48
48
|
*
|
|
49
|
-
* See https://
|
|
49
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/resolvers.html
|
|
50
50
|
*/
|
|
51
51
|
export interface ResolverOptions<S extends object = JSONSchema> {
|
|
52
52
|
name?: string;
|
|
@@ -126,7 +126,7 @@ export interface Plugin {
|
|
|
126
126
|
*
|
|
127
127
|
* The file info object currently only consists of a few properties, but it may grow in the future if plug-ins end up needing more information.
|
|
128
128
|
*
|
|
129
|
-
* See https://
|
|
129
|
+
* See https://apidevtools.com/json-schema-ref-parser/docs/plugins/file-info-object.html
|
|
130
130
|
*/
|
|
131
131
|
export interface FileInfo {
|
|
132
132
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apidevtools/json-schema-ref-parser",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.5",
|
|
4
4
|
"description": "Parse, Resolve, and Dereference JSON Schema $ref pointers",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepublishOnly": "yarn build",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"email": "apis@jonlu.ca"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
|
-
"homepage": "https://
|
|
49
|
+
"homepage": "https://apidevtools.com/json-schema-ref-parser/",
|
|
50
50
|
"repository": {
|
|
51
51
|
"type": "git",
|
|
52
52
|
"url": "https://github.com/APIDevTools/json-schema-ref-parser.git"
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"@eslint/js": "^9.28.0",
|
|
72
72
|
"@types/eslint": "^9.6.1",
|
|
73
73
|
"@types/js-yaml": "^4.0.9",
|
|
74
|
-
"@types/node": "^
|
|
75
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
76
|
-
"@typescript-eslint/parser": "^8.
|
|
77
|
-
"@vitest/coverage-v8": "^3.2.
|
|
74
|
+
"@types/node": "^24",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
76
|
+
"@typescript-eslint/parser": "^8.34.0",
|
|
77
|
+
"@vitest/coverage-v8": "^3.2.3",
|
|
78
78
|
"cross-env": "^7.0.3",
|
|
79
79
|
"eslint": "^9.28.0",
|
|
80
80
|
"eslint-config-prettier": "^10.1.5",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"prettier": "^3.5.3",
|
|
89
89
|
"rimraf": "^6.0.1",
|
|
90
90
|
"typescript": "^5.8.3",
|
|
91
|
-
"typescript-eslint": "^8.
|
|
92
|
-
"vitest": "^3.2.
|
|
91
|
+
"typescript-eslint": "^8.34.0",
|
|
92
|
+
"vitest": "^3.2.3"
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@types/json-schema": "^7.0.15",
|