vscode-json-languageservice
Advanced tools
Comparing version 4.2.0-next.1 to 4.2.0-next.2
@@ -6,2 +6,3 @@ | ||
* new API `LanguageService.getLanguageStatus` | ||
* support for $ref with $id | ||
@@ -8,0 +9,0 @@ 4.1.6 / 2021-07-16 |
@@ -31,3 +31,6 @@ /*--------------------------------------------------------------------------------------------- | ||
'time': { errorMessage: localize('timeFormatWarning', 'String is not a RFC3339 time.'), pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i }, | ||
'email': { errorMessage: localize('emailFormatWarning', 'String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ } | ||
'email': { errorMessage: localize('emailFormatWarning', 'String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))$/ }, | ||
'hostname': { errorMessage: localize('hostnameFormatWarning', 'String is not a hostname.'), pattern: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i }, | ||
'ipv4': { errorMessage: localize('ipv4FormatWarning', 'String is not an IPv4 address.'), pattern: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/ }, | ||
'ipv6': { errorMessage: localize('ipv6FormatWarning', 'String is not an IPv6 address.'), pattern: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i }, | ||
}; | ||
@@ -659,2 +662,5 @@ var ASTNodeImpl = /** @class */ (function () { | ||
case 'email': | ||
case 'hostname': | ||
case 'ipv4': | ||
case 'ipv6': | ||
var format = formats[schema.format]; | ||
@@ -661,0 +667,0 @@ if (!node.value || !format.pattern.exec(node.value)) { |
@@ -62,2 +62,3 @@ /*--------------------------------------------------------------------------------------------- | ||
this.dependencies = new Set(); | ||
this.anchors = new Map(); | ||
if (unresolvedSchemaContent) { | ||
@@ -77,3 +78,3 @@ this.unresolvedSchema = this.service.promise.resolve(new UnresolvedSchema(unresolvedSchemaContent)); | ||
this.resolvedSchema = this.getUnresolvedSchema().then(function (unresolved) { | ||
return _this.service.resolveSchemaContent(unresolved, _this.uri, _this.dependencies); | ||
return _this.service.resolveSchemaContent(unresolved, _this); | ||
}); | ||
@@ -88,2 +89,3 @@ } | ||
this.dependencies.clear(); | ||
this.anchors.clear(); | ||
return hasChanges; | ||
@@ -296,3 +298,3 @@ }; | ||
}; | ||
JSONSchemaService.prototype.resolveSchemaContent = function (schemaToResolve, schemaURL, dependencies) { | ||
JSONSchemaService.prototype.resolveSchemaContent = function (schemaToResolve, handle) { | ||
var _this = this; | ||
@@ -329,11 +331,14 @@ var resolveErrors = schemaToResolve.errors.slice(0); | ||
}; | ||
var merge = function (target, sourceRoot, sourceURI, refSegment) { | ||
var merge = function (target, section) { | ||
for (var key in section) { | ||
if (section.hasOwnProperty(key) && !target.hasOwnProperty(key)) { | ||
target[key] = section[key]; | ||
} | ||
} | ||
}; | ||
var mergeByJsonPointer = function (target, sourceRoot, sourceURI, refSegment) { | ||
var path = refSegment ? decodeURIComponent(refSegment) : undefined; | ||
var section = findSection(sourceRoot, path); | ||
if (section) { | ||
for (var key in section) { | ||
if (section.hasOwnProperty(key) && !target.hasOwnProperty(key)) { | ||
target[key] = section[key]; | ||
} | ||
} | ||
merge(target, section); | ||
} | ||
@@ -344,5 +349,36 @@ else { | ||
}; | ||
var resolveExternalLink = function (node, uri, refSegment, parentSchemaURL, parentSchemaDependencies) { | ||
var isSubSchemaRef = function (refSegment) { | ||
// Check if the first character is not '/' to determine whether it's a sub schema reference or a JSON Pointer | ||
return !!refSegment && refSegment.charAt(0) !== '/'; | ||
}; | ||
var reconstructRefURI = function (uri, fragment, separator) { | ||
if (separator === void 0) { separator = '#'; } | ||
return normalizeId("" + uri + separator + fragment); | ||
}; | ||
// To find which $refs point to which $ids we keep two maps: | ||
// pendingSubSchemas '$id' we expect to encounter (if they exist) | ||
// handle.anchors for the ones we have encountered | ||
var pendingSubSchemas = new Map(); | ||
var tryMergeSubSchema = function (target, id, handle) { | ||
// Get the full URI for the current schema to avoid matching schema1#hello and schema2#hello to the same | ||
// reference by accident | ||
var fullId = reconstructRefURI(handle.uri, id); | ||
var resolved = handle.anchors.get(fullId); | ||
if (resolved) { | ||
merge(target, resolved); | ||
return true; // return success | ||
} | ||
// This subschema has not been resolved yet | ||
// Remember the target to merge later once resolved | ||
var pending = pendingSubSchemas.get(fullId); | ||
if (!pending) { | ||
pending = []; | ||
pendingSubSchemas.set(fullId, pending); | ||
} | ||
pending.push(target); | ||
return false; // return failure - merge didn't occur | ||
}; | ||
var resolveExternalLink = function (node, uri, refSegment, parentHandle) { | ||
if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(uri)) { | ||
uri = contextService.resolveRelativePath(uri, parentSchemaURL); | ||
uri = contextService.resolveRelativePath(uri, parentHandle.uri); | ||
} | ||
@@ -352,3 +388,3 @@ uri = normalizeId(uri); | ||
return referencedHandle.getUnresolvedSchema().then(function (unresolvedSchema) { | ||
parentSchemaDependencies.add(uri); | ||
parentHandle.dependencies.add(uri); | ||
if (unresolvedSchema.errors.length) { | ||
@@ -358,7 +394,21 @@ var loc = refSegment ? uri + '#' + refSegment : uri; | ||
} | ||
merge(node, unresolvedSchema.schema, uri, refSegment); | ||
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies); | ||
// A placeholder promise that might execute later a ref resolution for the newly resolved schema | ||
var externalLinkPromise = Promise.resolve(true); | ||
if (refSegment === undefined || !isSubSchemaRef(refSegment)) { | ||
// This is not a sub schema, merge the regular way | ||
mergeByJsonPointer(node, unresolvedSchema.schema, uri, refSegment); | ||
} | ||
else { | ||
// This is a reference to a subschema | ||
if (!tryMergeSubSchema(node, refSegment, referencedHandle)) { | ||
// We weren't able to merge currently so we'll try to resolve this schema first to obtain subschemas | ||
// that could be missed | ||
// to improve: it would be enough to find the nodes, no need to resolve the full schema | ||
externalLinkPromise = resolveRefs(unresolvedSchema.schema, unresolvedSchema.schema, referencedHandle); | ||
} | ||
} | ||
return externalLinkPromise.then(function () { return resolveRefs(node, unresolvedSchema.schema, referencedHandle); }); | ||
}); | ||
}; | ||
var resolveRefs = function (node, parentSchema, parentSchemaURL, parentSchemaDependencies) { | ||
var resolveRefs = function (node, parentSchema, parentHandle) { | ||
if (!node || typeof node !== 'object') { | ||
@@ -424,8 +474,16 @@ return Promise.resolve(null); | ||
if (segments[0].length > 0) { | ||
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies)); | ||
// This is a reference to an external schema | ||
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentHandle)); | ||
return; | ||
} | ||
else { | ||
// This is a reference inside the current schema | ||
if (!seenRefs.has(ref)) { | ||
merge(next, parentSchema, parentSchemaURL, segments[1]); // can set next.$ref again, use seenRefs to avoid circle | ||
var id = segments[1]; | ||
if (id !== undefined && isSubSchemaRef(id)) { // A $ref to a sub-schema with an $id (i.e #hello) | ||
tryMergeSubSchema(next, id, handle); | ||
} | ||
else { // A $ref to a JSON Pointer (i.e #/definitions/foo) | ||
mergeByJsonPointer(next, parentSchema, parentHandle.uri, id); // can set next.$ref again, use seenRefs to avoid circle | ||
} | ||
seenRefs.add(ref); | ||
@@ -439,2 +497,31 @@ } | ||
}; | ||
var handleId = function (next) { | ||
// TODO figure out should loops be preventse | ||
var id = next.$id || next.id; | ||
if (typeof id === 'string' && id.charAt(0) === '#') { | ||
delete next.$id; | ||
delete next.id; | ||
// Use a blank separator, as the $id already has the '#' | ||
var fullId = reconstructRefURI(parentHandle.uri, id, ''); | ||
var resolved = parentHandle.anchors.get(fullId); | ||
if (!resolved) { | ||
// it's resolved now | ||
parentHandle.anchors.set(fullId, next); | ||
} | ||
else if (resolved !== next) { | ||
// Duplicate may occur in recursive $refs, but as long as they are the same object | ||
// it's ok, otherwise report and error | ||
resolveErrors.push(localize('json.schema.duplicateid', 'Duplicate id declaration: \'{0}\'', id)); | ||
} | ||
// Resolve all pending requests and cleanup the queue list | ||
var pending = pendingSubSchemas.get(fullId); | ||
if (pending) { | ||
for (var _i = 0, pending_1 = pending; _i < pending_1.length; _i++) { | ||
var target = pending_1[_i]; | ||
merge(target, next); | ||
} | ||
pendingSubSchemas.delete(fullId); | ||
} | ||
} | ||
}; | ||
while (toWalk.length) { | ||
@@ -446,2 +533,3 @@ var next = toWalk.pop(); | ||
seen.add(next); | ||
handleId(next); | ||
handleRef(next); | ||
@@ -451,3 +539,8 @@ } | ||
}; | ||
return resolveRefs(schema, schema, schemaURL, dependencies).then(function (_) { return new ResolvedSchema(schema, resolveErrors); }); | ||
return resolveRefs(schema, schema, handle).then(function (_) { | ||
for (var unresolvedSubschemaId in pendingSubSchemas) { | ||
resolveErrors.push(localize('json.schema.idnotfound', 'Subschema with id \'{0}\' was not found', unresolvedSubschemaId)); | ||
} | ||
return new ResolvedSchema(schema, resolveErrors); | ||
}); | ||
}; | ||
@@ -527,3 +620,4 @@ JSONSchemaService.prototype.getSchemaFromProperty = function (resource, document) { | ||
var id = schema.id || ('schemaservice://untitled/matchingSchemas/' + idCounter++); | ||
return this.resolveSchemaContent(new UnresolvedSchema(schema), id, new Set()).then(function (resolvedSchema) { | ||
var handle = this.addSchemaHandle(id, schema); | ||
return handle.getResolvedSchema().then(function (resolvedSchema) { | ||
return jsonDocument.getMatchingSchemas(resolvedSchema.schema).filter(function (s) { return !s.inverted; }); | ||
@@ -530,0 +624,0 @@ }); |
@@ -5,3 +5,2 @@ /*--------------------------------------------------------------------------------------------- | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { UnresolvedSchema } from './jsonSchemaService'; | ||
import { ErrorCode, Diagnostic, DiagnosticSeverity, Range } from '../jsonLanguageTypes'; | ||
@@ -90,3 +89,4 @@ import * as nls from 'vscode-nls'; | ||
var id = schema.id || ('schemaservice://untitled/' + idCounter++); | ||
return this.jsonSchemaService.resolveSchemaContent(new UnresolvedSchema(schema), id, new Set()).then(function (resolvedSchema) { | ||
var handle = this.jsonSchemaService.registerExternalSchema(id, [], schema); | ||
return handle.getResolvedSchema().then(function (resolvedSchema) { | ||
return getDiagnostics(resolvedSchema); | ||
@@ -93,0 +93,0 @@ }); |
@@ -74,2 +74,3 @@ /*--------------------------------------------------------------------------------------------- | ||
this.dependencies = new Set(); | ||
this.anchors = new Map(); | ||
if (unresolvedSchemaContent) { | ||
@@ -89,3 +90,3 @@ this.unresolvedSchema = this.service.promise.resolve(new UnresolvedSchema(unresolvedSchemaContent)); | ||
this.resolvedSchema = this.getUnresolvedSchema().then(function (unresolved) { | ||
return _this.service.resolveSchemaContent(unresolved, _this.uri, _this.dependencies); | ||
return _this.service.resolveSchemaContent(unresolved, _this); | ||
}); | ||
@@ -100,2 +101,3 @@ } | ||
this.dependencies.clear(); | ||
this.anchors.clear(); | ||
return hasChanges; | ||
@@ -308,3 +310,3 @@ }; | ||
}; | ||
JSONSchemaService.prototype.resolveSchemaContent = function (schemaToResolve, schemaURL, dependencies) { | ||
JSONSchemaService.prototype.resolveSchemaContent = function (schemaToResolve, handle) { | ||
var _this = this; | ||
@@ -341,11 +343,14 @@ var resolveErrors = schemaToResolve.errors.slice(0); | ||
}; | ||
var merge = function (target, sourceRoot, sourceURI, refSegment) { | ||
var merge = function (target, section) { | ||
for (var key in section) { | ||
if (section.hasOwnProperty(key) && !target.hasOwnProperty(key)) { | ||
target[key] = section[key]; | ||
} | ||
} | ||
}; | ||
var mergeByJsonPointer = function (target, sourceRoot, sourceURI, refSegment) { | ||
var path = refSegment ? decodeURIComponent(refSegment) : undefined; | ||
var section = findSection(sourceRoot, path); | ||
if (section) { | ||
for (var key in section) { | ||
if (section.hasOwnProperty(key) && !target.hasOwnProperty(key)) { | ||
target[key] = section[key]; | ||
} | ||
} | ||
merge(target, section); | ||
} | ||
@@ -356,5 +361,36 @@ else { | ||
}; | ||
var resolveExternalLink = function (node, uri, refSegment, parentSchemaURL, parentSchemaDependencies) { | ||
var isSubSchemaRef = function (refSegment) { | ||
// Check if the first character is not '/' to determine whether it's a sub schema reference or a JSON Pointer | ||
return !!refSegment && refSegment.charAt(0) !== '/'; | ||
}; | ||
var reconstructRefURI = function (uri, fragment, separator) { | ||
if (separator === void 0) { separator = '#'; } | ||
return normalizeId("" + uri + separator + fragment); | ||
}; | ||
// To find which $refs point to which $ids we keep two maps: | ||
// pendingSubSchemas '$id' we expect to encounter (if they exist) | ||
// handle.anchors for the ones we have encountered | ||
var pendingSubSchemas = new Map(); | ||
var tryMergeSubSchema = function (target, id, handle) { | ||
// Get the full URI for the current schema to avoid matching schema1#hello and schema2#hello to the same | ||
// reference by accident | ||
var fullId = reconstructRefURI(handle.uri, id); | ||
var resolved = handle.anchors.get(fullId); | ||
if (resolved) { | ||
merge(target, resolved); | ||
return true; // return success | ||
} | ||
// This subschema has not been resolved yet | ||
// Remember the target to merge later once resolved | ||
var pending = pendingSubSchemas.get(fullId); | ||
if (!pending) { | ||
pending = []; | ||
pendingSubSchemas.set(fullId, pending); | ||
} | ||
pending.push(target); | ||
return false; // return failure - merge didn't occur | ||
}; | ||
var resolveExternalLink = function (node, uri, refSegment, parentHandle) { | ||
if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(uri)) { | ||
uri = contextService.resolveRelativePath(uri, parentSchemaURL); | ||
uri = contextService.resolveRelativePath(uri, parentHandle.uri); | ||
} | ||
@@ -364,3 +400,3 @@ uri = normalizeId(uri); | ||
return referencedHandle.getUnresolvedSchema().then(function (unresolvedSchema) { | ||
parentSchemaDependencies.add(uri); | ||
parentHandle.dependencies.add(uri); | ||
if (unresolvedSchema.errors.length) { | ||
@@ -370,7 +406,21 @@ var loc = refSegment ? uri + '#' + refSegment : uri; | ||
} | ||
merge(node, unresolvedSchema.schema, uri, refSegment); | ||
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies); | ||
// A placeholder promise that might execute later a ref resolution for the newly resolved schema | ||
var externalLinkPromise = Promise.resolve(true); | ||
if (refSegment === undefined || !isSubSchemaRef(refSegment)) { | ||
// This is not a sub schema, merge the regular way | ||
mergeByJsonPointer(node, unresolvedSchema.schema, uri, refSegment); | ||
} | ||
else { | ||
// This is a reference to a subschema | ||
if (!tryMergeSubSchema(node, refSegment, referencedHandle)) { | ||
// We weren't able to merge currently so we'll try to resolve this schema first to obtain subschemas | ||
// that could be missed | ||
// to improve: it would be enough to find the nodes, no need to resolve the full schema | ||
externalLinkPromise = resolveRefs(unresolvedSchema.schema, unresolvedSchema.schema, referencedHandle); | ||
} | ||
} | ||
return externalLinkPromise.then(function () { return resolveRefs(node, unresolvedSchema.schema, referencedHandle); }); | ||
}); | ||
}; | ||
var resolveRefs = function (node, parentSchema, parentSchemaURL, parentSchemaDependencies) { | ||
var resolveRefs = function (node, parentSchema, parentHandle) { | ||
if (!node || typeof node !== 'object') { | ||
@@ -436,8 +486,16 @@ return Promise.resolve(null); | ||
if (segments[0].length > 0) { | ||
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies)); | ||
// This is a reference to an external schema | ||
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentHandle)); | ||
return; | ||
} | ||
else { | ||
// This is a reference inside the current schema | ||
if (!seenRefs.has(ref)) { | ||
merge(next, parentSchema, parentSchemaURL, segments[1]); // can set next.$ref again, use seenRefs to avoid circle | ||
var id = segments[1]; | ||
if (id !== undefined && isSubSchemaRef(id)) { // A $ref to a sub-schema with an $id (i.e #hello) | ||
tryMergeSubSchema(next, id, handle); | ||
} | ||
else { // A $ref to a JSON Pointer (i.e #/definitions/foo) | ||
mergeByJsonPointer(next, parentSchema, parentHandle.uri, id); // can set next.$ref again, use seenRefs to avoid circle | ||
} | ||
seenRefs.add(ref); | ||
@@ -451,2 +509,31 @@ } | ||
}; | ||
var handleId = function (next) { | ||
// TODO figure out should loops be preventse | ||
var id = next.$id || next.id; | ||
if (typeof id === 'string' && id.charAt(0) === '#') { | ||
delete next.$id; | ||
delete next.id; | ||
// Use a blank separator, as the $id already has the '#' | ||
var fullId = reconstructRefURI(parentHandle.uri, id, ''); | ||
var resolved = parentHandle.anchors.get(fullId); | ||
if (!resolved) { | ||
// it's resolved now | ||
parentHandle.anchors.set(fullId, next); | ||
} | ||
else if (resolved !== next) { | ||
// Duplicate may occur in recursive $refs, but as long as they are the same object | ||
// it's ok, otherwise report and error | ||
resolveErrors.push(localize('json.schema.duplicateid', 'Duplicate id declaration: \'{0}\'', id)); | ||
} | ||
// Resolve all pending requests and cleanup the queue list | ||
var pending = pendingSubSchemas.get(fullId); | ||
if (pending) { | ||
for (var _i = 0, pending_1 = pending; _i < pending_1.length; _i++) { | ||
var target = pending_1[_i]; | ||
merge(target, next); | ||
} | ||
pendingSubSchemas.delete(fullId); | ||
} | ||
} | ||
}; | ||
while (toWalk.length) { | ||
@@ -458,2 +545,3 @@ var next = toWalk.pop(); | ||
seen.add(next); | ||
handleId(next); | ||
handleRef(next); | ||
@@ -463,3 +551,8 @@ } | ||
}; | ||
return resolveRefs(schema, schema, schemaURL, dependencies).then(function (_) { return new ResolvedSchema(schema, resolveErrors); }); | ||
return resolveRefs(schema, schema, handle).then(function (_) { | ||
for (var unresolvedSubschemaId in pendingSubSchemas) { | ||
resolveErrors.push(localize('json.schema.idnotfound', 'Subschema with id \'{0}\' was not found', unresolvedSubschemaId)); | ||
} | ||
return new ResolvedSchema(schema, resolveErrors); | ||
}); | ||
}; | ||
@@ -539,3 +632,4 @@ JSONSchemaService.prototype.getSchemaFromProperty = function (resource, document) { | ||
var id = schema.id || ('schemaservice://untitled/matchingSchemas/' + idCounter++); | ||
return this.resolveSchemaContent(new UnresolvedSchema(schema), id, new Set()).then(function (resolvedSchema) { | ||
var handle = this.addSchemaHandle(id, schema); | ||
return handle.getResolvedSchema().then(function (resolvedSchema) { | ||
return jsonDocument.getMatchingSchemas(resolvedSchema.schema).filter(function (s) { return !s.inverted; }); | ||
@@ -542,0 +636,0 @@ }); |
@@ -11,3 +11,3 @@ /*--------------------------------------------------------------------------------------------- | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./jsonSchemaService", "../jsonLanguageTypes", "vscode-nls", "../utils/objects"], factory); | ||
define(["require", "exports", "../jsonLanguageTypes", "vscode-nls", "../utils/objects"], factory); | ||
} | ||
@@ -18,3 +18,2 @@ })(function (require, exports) { | ||
exports.JSONValidation = void 0; | ||
var jsonSchemaService_1 = require("./jsonSchemaService"); | ||
var jsonLanguageTypes_1 = require("../jsonLanguageTypes"); | ||
@@ -103,3 +102,4 @@ var nls = require("vscode-nls"); | ||
var id = schema.id || ('schemaservice://untitled/' + idCounter++); | ||
return this.jsonSchemaService.resolveSchemaContent(new jsonSchemaService_1.UnresolvedSchema(schema), id, new Set()).then(function (resolvedSchema) { | ||
var handle = this.jsonSchemaService.registerExternalSchema(id, [], schema); | ||
return handle.getResolvedSchema().then(function (resolvedSchema) { | ||
return getDiagnostics(resolvedSchema); | ||
@@ -106,0 +106,0 @@ }); |
{ | ||
"name": "vscode-json-languageservice", | ||
"version": "4.2.0-next.1", | ||
"version": "4.2.0-next.2", | ||
"description": "Language service for JSON", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/jsonLanguageService.js", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
514141
10336