@@ -94,14 +94,21 @@ export class $RefParser {
9494 */
9595 public async bundle ( {
9696 arrayBuffer,
97+ fetch,
9798 pathOrUrlOrSchema,
9899 resolvedInput,
99100 } : {
100101 arrayBuffer ?: ArrayBuffer ;
102+ fetch ?: RequestInit ;
101103 pathOrUrlOrSchema : JSONSchema | string | unknown ;
102104 resolvedInput ?: ResolvedInput ;
103105 } ) : Promise < JSONSchema > {
104- await this . parse ( { arrayBuffer, pathOrUrlOrSchema, resolvedInput } ) ;
106+ await this . parse ( {
107+ arrayBuffer,
108+ fetch,
109+ pathOrUrlOrSchema,
110+ resolvedInput,
111+ } ) ;
105112 await resolveExternal ( this , this . options ) ;
106113 const errors = JSONParserErrorGroup . getParserErrors ( this ) ;
107114 if ( errors . length > 0 ) {
@@ -125,11 +132,16 @@ export class $RefParser {
125132 * @param pathOrUrlOrSchema A JSON Schema object, or the file path or URL of a JSON Schema file.
126133 */
127134 public async dereference ( {
135+ fetch,
128136 pathOrUrlOrSchema,
129137 } : {
138+ fetch ?: RequestInit ;
130139 pathOrUrlOrSchema : JSONSchema | string | unknown ;
131140 } ) : Promise < JSONSchema > {
132- await this . parse ( { pathOrUrlOrSchema } ) ;
141+ await this . parse ( {
142+ fetch,
143+ pathOrUrlOrSchema,
144+ } ) ;
133145 await resolveExternal ( this , this . options ) ;
134146 const errors = JSONParserErrorGroup . getParserErrors ( this ) ;
135147 if ( errors . length > 0 ) {
@@ -153,10 +165,12 @@ export class $RefParser {
153165 */
154166 public async parse ( {
155167 arrayBuffer,
168+ fetch,
156169 pathOrUrlOrSchema,
157170 resolvedInput : _resolvedInput ,
158171 } : {
159172 arrayBuffer ?: ArrayBuffer ;
173+ fetch ?: RequestInit ;
160174 pathOrUrlOrSchema : JSONSchema | string | unknown ;
161175 resolvedInput ?: ResolvedInput ;
162176 } ) : Promise < { schema : JSONSchema } > {
@@ -182,7 +196,11 @@ export class $RefParser {
182196 $refAdded . pathType = type ;
183197 try {
184198 const resolver = type === 'file' ? fileResolver : urlResolver ;
185- await resolver . handler ( file , arrayBuffer ) ;
199+ await resolver . handler ( {
200+ arrayBuffer,
201+ fetch,
202+ file,
203+ } ) ;
186204 const parseResult = await parseFile ( file , this . options ) ;
187205 $refAdded . value = parseResult . result ;
188206 schema = parseResult . result ;
0 commit comments