File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -88,18 +88,18 @@ function parseHttpHeaders(httpHeaders: Record<string, any>): Headers {
88
88
interface LoadOptions extends GlobalContext {
89
89
rootURL : URL ;
90
90
schemas : SchemaMap ;
91
+ urlCache ?: Set < string > ; // URL cache (prevent URLs from being loaded over and over)
91
92
httpHeaders ?: Headers ;
92
93
httpMethod ?: string ;
93
94
}
94
95
95
- // temporary cache for load()
96
- let urlCache = new Set < string > ( ) ; // URL cache (prevent URLs from being loaded over and over)
97
-
98
96
/** Load a schema from local path or remote URL */
99
97
export default async function load (
100
98
schema : URL | PartialSchema ,
101
99
options : LoadOptions
102
100
) : Promise < { [ url : string ] : PartialSchema } > {
101
+ const urlCache = options . urlCache || new Set < string > ( ) ;
102
+
103
103
const isJSON = schema instanceof URL === false ; // if this is dynamically-passed-in JSON, we’ll have to change a few things
104
104
let schemaID = isJSON ? new URL ( VIRTUAL_JSON_URL ) . href : ( schema . href as string ) ;
105
105
@@ -182,7 +182,7 @@ export default async function load(
182
182
183
183
const nextURL = isRemoteURL ? new URL ( refURL ) : new URL ( slash ( refURL ) , schema as URL ) ;
184
184
refPromises . push (
185
- load ( nextURL , options ) . then ( ( subschemas ) => {
185
+ load ( nextURL , { ... options , urlCache } ) . then ( ( subschemas ) => {
186
186
for ( const subschemaURL of Object . keys ( subschemas ) ) {
187
187
schemas [ subschemaURL ] = subschemas [ subschemaURL ] ;
188
188
}
You can’t perform that action at this time.
0 commit comments