@@ -57,7 +57,7 @@ export interface ISchemaHandle {
57
57
/**
58
58
* The schema id
59
59
*/
60
- url : string ;
60
+ uri : string ;
61
61
62
62
/**
63
63
* The schema from the file, with potential $ref references
@@ -127,17 +127,17 @@ type SchemaDependencies = Set<string>;
127
127
128
128
class SchemaHandle implements ISchemaHandle {
129
129
130
- public readonly url : string ;
130
+ public readonly uri : string ;
131
131
public readonly dependencies : SchemaDependencies ;
132
132
public readonly anchors : Map < string , JSONSchema > ;
133
133
134
134
private resolvedSchema : Thenable < ResolvedSchema > | undefined ;
135
135
private unresolvedSchema : Thenable < UnresolvedSchema > | undefined ;
136
136
private readonly service : JSONSchemaService ;
137
137
138
- constructor ( service : JSONSchemaService , url : string , unresolvedSchemaContent ?: JSONSchema ) {
138
+ constructor ( service : JSONSchemaService , uri : string , unresolvedSchemaContent ?: JSONSchema ) {
139
139
this . service = service ;
140
- this . url = url ;
140
+ this . uri = uri ;
141
141
this . dependencies = new Set ( ) ;
142
142
this . anchors = new Map ( ) ;
143
143
if ( unresolvedSchemaContent ) {
@@ -147,7 +147,7 @@ class SchemaHandle implements ISchemaHandle {
147
147
148
148
public getUnresolvedSchema ( ) : Thenable < UnresolvedSchema > {
149
149
if ( ! this . unresolvedSchema ) {
150
- this . unresolvedSchema = this . service . loadSchema ( this . url ) ;
150
+ this . unresolvedSchema = this . service . loadSchema ( this . uri ) ;
151
151
}
152
152
return this . unresolvedSchema ;
153
153
}
@@ -289,9 +289,9 @@ export class JSONSchemaService implements IJSONSchemaService {
289
289
const curr = toWalk . pop ( ) ! ;
290
290
for ( let i = 0 ; i < all . length ; i ++ ) {
291
291
const handle = all [ i ] ;
292
- if ( handle && ( handle . url === curr || handle . dependencies . has ( curr ) ) ) {
293
- if ( handle . url !== curr ) {
294
- toWalk . push ( handle . url ) ;
292
+ if ( handle && ( handle . uri === curr || handle . dependencies . has ( curr ) ) ) {
293
+ if ( handle . uri !== curr ) {
294
+ toWalk . push ( handle . uri ) ;
295
295
}
296
296
handle . clearSchema ( ) ;
297
297
all [ i ] = undefined ;
@@ -471,7 +471,7 @@ export class JSONSchemaService implements IJSONSchemaService {
471
471
const tryMergeSubSchema = ( target : JSONSchema , id : string , handle : SchemaHandle ) : boolean => {
472
472
// Get the full URI for the current schema to avoid matching schema1#hello and schema2#hello to the same
473
473
// reference by accident
474
- const fullId = reconstructRefURI ( handle . url , id ) ;
474
+ const fullId = reconstructRefURI ( handle . uri , id ) ;
475
475
const resolved = handle . anchors . get ( fullId ) ;
476
476
if ( resolved ) {
477
477
merge ( target , resolved ) ;
@@ -491,7 +491,7 @@ export class JSONSchemaService implements IJSONSchemaService {
491
491
492
492
const resolveExternalLink = ( node : JSONSchema , uri : string , refSegment : string | undefined , parentHandle : SchemaHandle ) : Thenable < any > => {
493
493
if ( contextService && ! / ^ [ A - Z a - z ] [ A - Z a - z 0 - 9 + \- . + ] * : \/ \/ .* / . test ( uri ) ) {
494
- uri = contextService . resolveRelativePath ( uri , parentHandle . url ) ;
494
+ uri = contextService . resolveRelativePath ( uri , parentHandle . uri ) ;
495
495
}
496
496
uri = normalizeId ( uri ) ;
497
497
const referencedHandle = this . getOrAddSchemaHandle ( uri ) ;
@@ -578,7 +578,7 @@ export class JSONSchemaService implements IJSONSchemaService {
578
578
if ( id !== undefined && isSubSchemaRef ( id ) ) { // A $ref to a sub-schema with an $id (i.e #hello)
579
579
tryMergeSubSchema ( next , id , handle ) ;
580
580
} else { // A $ref to a JSON Pointer (i.e #/definitions/foo)
581
- mergeByJsonPointer ( next , parentSchema , parentHandle . url , id ) ; // can set next.$ref again, use seenRefs to avoid circle
581
+ mergeByJsonPointer ( next , parentSchema , parentHandle . uri , id ) ; // can set next.$ref again, use seenRefs to avoid circle
582
582
}
583
583
seenRefs . add ( ref ) ;
584
584
}
@@ -597,7 +597,7 @@ export class JSONSchemaService implements IJSONSchemaService {
597
597
delete next . $id ;
598
598
delete next . id ;
599
599
// Use a blank separator, as the $id already has the '#'
600
- const fullId = reconstructRefURI ( parentHandle . url , id , '' ) ;
600
+ const fullId = reconstructRefURI ( parentHandle . uri , id , '' ) ;
601
601
602
602
const resolved = parentHandle . anchors . get ( fullId ) ;
603
603
if ( ! resolved ) {
0 commit comments