Skip to content

Commit a4cc925

Browse files
committed
rename SchemaHandle.url to uri
1 parent b4c3512 commit a4cc925

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/services/jsonSchemaService.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface ISchemaHandle {
5757
/**
5858
* The schema id
5959
*/
60-
url: string;
60+
uri: string;
6161

6262
/**
6363
* The schema from the file, with potential $ref references
@@ -127,17 +127,17 @@ type SchemaDependencies = Set<string>;
127127

128128
class SchemaHandle implements ISchemaHandle {
129129

130-
public readonly url: string;
130+
public readonly uri: string;
131131
public readonly dependencies: SchemaDependencies;
132132
public readonly anchors: Map<string, JSONSchema>;
133133

134134
private resolvedSchema: Thenable<ResolvedSchema> | undefined;
135135
private unresolvedSchema: Thenable<UnresolvedSchema> | undefined;
136136
private readonly service: JSONSchemaService;
137137

138-
constructor(service: JSONSchemaService, url: string, unresolvedSchemaContent?: JSONSchema) {
138+
constructor(service: JSONSchemaService, uri: string, unresolvedSchemaContent?: JSONSchema) {
139139
this.service = service;
140-
this.url = url;
140+
this.uri = uri;
141141
this.dependencies = new Set();
142142
this.anchors = new Map();
143143
if (unresolvedSchemaContent) {
@@ -147,7 +147,7 @@ class SchemaHandle implements ISchemaHandle {
147147

148148
public getUnresolvedSchema(): Thenable<UnresolvedSchema> {
149149
if (!this.unresolvedSchema) {
150-
this.unresolvedSchema = this.service.loadSchema(this.url);
150+
this.unresolvedSchema = this.service.loadSchema(this.uri);
151151
}
152152
return this.unresolvedSchema;
153153
}
@@ -289,9 +289,9 @@ export class JSONSchemaService implements IJSONSchemaService {
289289
const curr = toWalk.pop()!;
290290
for (let i = 0; i < all.length; i++) {
291291
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);
295295
}
296296
handle.clearSchema();
297297
all[i] = undefined;
@@ -471,7 +471,7 @@ export class JSONSchemaService implements IJSONSchemaService {
471471
const tryMergeSubSchema = (target: JSONSchema, id: string, handle: SchemaHandle): boolean => {
472472
// Get the full URI for the current schema to avoid matching schema1#hello and schema2#hello to the same
473473
// reference by accident
474-
const fullId = reconstructRefURI(handle.url, id);
474+
const fullId = reconstructRefURI(handle.uri, id);
475475
const resolved = handle.anchors.get(fullId);
476476
if (resolved) {
477477
merge(target, resolved);
@@ -491,7 +491,7 @@ export class JSONSchemaService implements IJSONSchemaService {
491491

492492
const resolveExternalLink = (node: JSONSchema, uri: string, refSegment: string | undefined, parentHandle: SchemaHandle): Thenable<any> => {
493493
if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(uri)) {
494-
uri = contextService.resolveRelativePath(uri, parentHandle.url);
494+
uri = contextService.resolveRelativePath(uri, parentHandle.uri);
495495
}
496496
uri = normalizeId(uri);
497497
const referencedHandle = this.getOrAddSchemaHandle(uri);
@@ -578,7 +578,7 @@ export class JSONSchemaService implements IJSONSchemaService {
578578
if (id !== undefined && isSubSchemaRef(id)) { // A $ref to a sub-schema with an $id (i.e #hello)
579579
tryMergeSubSchema(next, id, handle);
580580
} 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
582582
}
583583
seenRefs.add(ref);
584584
}
@@ -597,7 +597,7 @@ export class JSONSchemaService implements IJSONSchemaService {
597597
delete next.$id;
598598
delete next.id;
599599
// Use a blank separator, as the $id already has the '#'
600-
const fullId = reconstructRefURI(parentHandle.url, id, '');
600+
const fullId = reconstructRefURI(parentHandle.uri, id, '');
601601

602602
const resolved = parentHandle.anchors.get(fullId);
603603
if (!resolved) {

0 commit comments

Comments
 (0)