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 @@ -54,16 +54,16 @@ export function resolveSchema(url: string): URL {
54
54
interface LoadOptions extends GlobalContext {
55
55
rootURL : URL ;
56
56
schemas : SchemaMap ;
57
+ urlCache ?: Set < string > ; // URL cache (prevent URLs from being loaded over and over)
57
58
}
58
59
59
- // temporary cache for load()
60
- let urlCache = new Set < string > ( ) ; // URL cache (prevent URLs from being loaded over and over)
61
-
62
60
/** Load a schema from local path or remote URL */
63
61
export default async function load (
64
62
schema : URL | PartialSchema ,
65
63
options : LoadOptions
66
64
) : Promise < { [ url : string ] : PartialSchema } > {
65
+ const urlCache = options . urlCache || new Set < string > ( ) ;
66
+
67
67
const isJSON = schema instanceof URL === false ; // if this is dynamically-passed-in JSON, we’ll have to change a few things
68
68
let schemaID = isJSON ? new URL ( VIRTUAL_JSON_URL ) . href : schema . href ;
69
69
@@ -136,7 +136,7 @@ export default async function load(
136
136
137
137
const nextURL = isRemoteURL ? new URL ( refURL ) : new URL ( slash ( refURL ) , schema as URL ) ;
138
138
refPromises . push (
139
- load ( nextURL , options ) . then ( ( subschemas ) => {
139
+ load ( nextURL , { ... options , urlCache } ) . then ( ( subschemas ) => {
140
140
for ( const subschemaURL of Object . keys ( subschemas ) ) {
141
141
schemas [ subschemaURL ] = subschemas [ subschemaURL ] ;
142
142
}
You can’t perform that action at this time.
0 commit comments