@@ -37,7 +37,7 @@ export type RefParserSchema = string | JSONSchema;
37
37
*
38
38
* @class
39
39
*/
40
- export class $RefParser < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > {
40
+ export class $RefParser < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > {
41
41
/**
42
42
* The parsed (and possibly dereferenced) JSON schema object
43
43
*
@@ -52,7 +52,7 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
52
52
* @type {$Refs }
53
53
* @readonly
54
54
*/
55
- $refs = new $Refs < S > ( ) ;
55
+ $refs = new $Refs < S , O > ( ) ;
56
56
57
57
/**
58
58
* Parses the given JSON schema.
@@ -143,32 +143,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
143
143
}
144
144
}
145
145
146
- public static parse < S extends JSONSchema = JSONSchema > ( schema : S | string ) : Promise < S > ;
147
- public static parse < S extends JSONSchema = JSONSchema > (
146
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
147
+ schema : S | string ,
148
+ ) : Promise < S > ;
149
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
148
150
schema : S | string ,
149
151
callback : SchemaCallback < S > ,
150
152
) : Promise < void > ;
151
- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
153
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
152
154
schema : S | string ,
153
155
options : O ,
154
156
) : Promise < S > ;
155
- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
157
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
156
158
schema : S | string ,
157
159
options : O ,
158
160
callback : SchemaCallback < S > ,
159
161
) : Promise < void > ;
160
- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
162
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
161
163
baseUrl : string ,
162
164
schema : S | string ,
163
165
options : O ,
164
166
) : Promise < S > ;
165
- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
167
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
166
168
baseUrl : string ,
167
169
schema : S | string ,
168
170
options : O ,
169
171
callback : SchemaCallback < S > ,
170
172
) : Promise < void > ;
171
- public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
173
+ public static parse < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
172
174
| Promise < S >
173
175
| Promise < void > {
174
176
const parser = new $RefParser < S , O > ( ) ;
@@ -186,12 +188,12 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
186
188
* @param options (optional)
187
189
* @param callback (optional) A callback that will receive a `$Refs` object
188
190
*/
189
- public resolve ( schema : S | string ) : Promise < $Refs < S > > ;
190
- public resolve ( schema : S | string , callback : $RefsCallback < S > ) : Promise < void > ;
191
- public resolve ( schema : S | string , options : O ) : Promise < $Refs < S > > ;
192
- public resolve ( schema : S | string , options : O , callback : $RefsCallback < S > ) : Promise < void > ;
193
- public resolve ( baseUrl : string , schema : S | string , options : O ) : Promise < $Refs < S > > ;
194
- public resolve ( baseUrl : string , schema : S | string , options : O , callback : $RefsCallback < S > ) : Promise < void > ;
191
+ public resolve ( schema : S | string ) : Promise < $Refs < S , O > > ;
192
+ public resolve ( schema : S | string , callback : $RefsCallback < S , O > ) : Promise < void > ;
193
+ public resolve ( schema : S | string , options : O ) : Promise < $Refs < S , O > > ;
194
+ public resolve ( schema : S | string , options : O , callback : $RefsCallback < S , O > ) : Promise < void > ;
195
+ public resolve ( baseUrl : string , schema : S | string , options : O ) : Promise < $Refs < S , O > > ;
196
+ public resolve ( baseUrl : string , schema : S | string , options : O , callback : $RefsCallback < S , O > ) : Promise < void > ;
195
197
async resolve ( ) {
196
198
const args = normalizeArgs < S , O > ( arguments ) ;
197
199
@@ -216,32 +218,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
216
218
* @param options (optional)
217
219
* @param callback (optional) A callback that will receive a `$Refs` object
218
220
*/
219
- public static resolve < S extends JSONSchema = JSONSchema > ( schema : S | string ) : Promise < $Refs < S > > ;
220
- public static resolve < S extends JSONSchema = JSONSchema > (
221
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
222
+ schema : S | string ,
223
+ ) : Promise < $Refs < S , O > > ;
224
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
221
225
schema : S | string ,
222
- callback : $RefsCallback < S > ,
226
+ callback : $RefsCallback < S , O > ,
223
227
) : Promise < void > ;
224
- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
228
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
225
229
schema : S | string ,
226
230
options : O ,
227
- ) : Promise < $Refs < S > > ;
228
- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
231
+ ) : Promise < $Refs < S , O > > ;
232
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
229
233
schema : S | string ,
230
234
options : O ,
231
- callback : $RefsCallback < S > ,
235
+ callback : $RefsCallback < S , O > ,
232
236
) : Promise < void > ;
233
- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
237
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
234
238
baseUrl : string ,
235
239
schema : S | string ,
236
240
options : O ,
237
- ) : Promise < $Refs < S > > ;
238
- public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
241
+ ) : Promise < $Refs < S , O > > ;
242
+ public static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
239
243
baseUrl : string ,
240
244
schema : S | string ,
241
245
options : O ,
242
- callback : $RefsCallback < S > ,
246
+ callback : $RefsCallback < S , O > ,
243
247
) : Promise < void > ;
244
- static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
248
+ static resolve < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
245
249
| Promise < S >
246
250
| Promise < void > {
247
251
const instance = new $RefParser < S , O > ( ) ;
@@ -259,34 +263,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
259
263
* @param options (optional)
260
264
* @param callback (optional) A callback that will receive the bundled schema object
261
265
*/
262
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
266
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
263
267
schema : S | string ,
264
268
) : Promise < S > ;
265
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
269
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
266
270
schema : S | string ,
267
271
callback : SchemaCallback < S > ,
268
272
) : Promise < void > ;
269
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
273
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
270
274
schema : S | string ,
271
275
options : O ,
272
276
) : Promise < S > ;
273
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
277
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
274
278
schema : S | string ,
275
279
options : O ,
276
280
callback : SchemaCallback < S > ,
277
281
) : Promise < void > ;
278
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
282
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
279
283
baseUrl : string ,
280
284
schema : S | string ,
281
285
options : O ,
282
286
) : Promise < S > ;
283
- public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
287
+ public static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
284
288
baseUrl : string ,
285
289
schema : S | string ,
286
290
options : O ,
287
291
callback : SchemaCallback < S > ,
288
292
) : Promise < S > ;
289
- static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
293
+ static bundle < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
290
294
| Promise < S >
291
295
| Promise < void > {
292
296
const instance = new $RefParser < S , O > ( ) ;
@@ -333,34 +337,34 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
333
337
* @param options (optional)
334
338
* @param callback (optional) A callback that will receive the dereferenced schema object
335
339
*/
336
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
340
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
337
341
schema : S | string ,
338
342
) : Promise < S > ;
339
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
343
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
340
344
schema : S | string ,
341
345
callback : SchemaCallback < S > ,
342
346
) : Promise < void > ;
343
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
347
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
344
348
schema : S | string ,
345
349
options : O ,
346
350
) : Promise < S > ;
347
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
351
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
348
352
schema : S | string ,
349
353
options : O ,
350
354
callback : SchemaCallback < S > ,
351
355
) : Promise < void > ;
352
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
356
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
353
357
baseUrl : string ,
354
358
schema : S | string ,
355
359
options : O ,
356
360
) : Promise < S > ;
357
- public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
361
+ public static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
358
362
baseUrl : string ,
359
363
schema : S | string ,
360
364
options : O ,
361
365
callback : SchemaCallback < S > ,
362
366
) : Promise < void > ;
363
- static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > ( ) :
367
+ static dereference < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > ( ) :
364
368
| Promise < S >
365
369
| Promise < void > {
366
370
const instance = new $RefParser < S , O > ( ) ;
@@ -400,7 +404,7 @@ export class $RefParser<S extends JSONSchema = JSONSchema, O extends ParserOptio
400
404
}
401
405
export default $RefParser ;
402
406
403
- function finalize < S extends JSONSchema = JSONSchema , O extends ParserOptions = ParserOptions > (
407
+ function finalize < S extends JSONSchema = JSONSchema , O extends ParserOptions < S > = ParserOptions < S > > (
404
408
parser : $RefParser < S , O > ,
405
409
) {
406
410
const errors = JSONParserErrorGroup . getParserErrors ( parser ) ;
0 commit comments