You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
errors.push(l10n.t('Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.',toDisplayString(url)));
407
+
errors.push(toDiagnostic(l10n.t('Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.',toDisplayString(url)),ErrorCode.SchemaResolveError));
402
408
content=content.trimStart();
403
409
}
404
410
405
411
letschemaContent: JSONSchema={};
406
412
constjsonErrors: Json.ParseError[]=[];
407
413
schemaContent=Json.parse(content,jsonErrors);
408
414
if(jsonErrors.length){
409
-
errors.push(l10n.t('Unable to parse content from \'{0}\': Parse error at offset {1}.',toDisplayString(url),jsonErrors[0].offset));
415
+
errors.push(toDiagnostic(l10n.t('Unable to parse content from \'{0}\': Parse error at offset {1}.',toDisplayString(url),jsonErrors[0].offset),ErrorCode.SchemaResolveError));
returnthis.promise.resolve(newResolvedSchema({},[l10n.t("Draft-03 schemas are not supported.")],[],schemaDraft));
450
+
returnthis.promise.resolve(newResolvedSchema({},[toDiagnostic(l10n.t("Draft-03 schemas are not supported."),ErrorCode.SchemaUnsupportedFeature)],[],schemaDraft));
436
451
}
437
452
438
453
letusesUnsupportedFeatures=newSet();
@@ -482,7 +497,8 @@ export class JSONSchemaService implements IJSONSchemaService {
482
497
if(section){
483
498
merge(target,section);
484
499
}else{
485
-
resolveErrors.push(l10n.t('$ref \'{0}\' in \'{1}\' can not be resolved.',refSegment||'',sourceHandle.uri));
500
+
constmessage=l10n.t('$ref \'{0}\' in \'{1}\' can not be resolved.',refSegment||'',sourceHandle.uri)
@@ -558,9 +575,9 @@ export class JSONSchemaService implements IJSONSchemaService {
558
575
returnresult;
559
576
};
560
577
returnresolveRefs(schema,schema,handle).then(_=>{
561
-
letresolveWarnings: string[]=[];
578
+
letresolveWarnings: SchemaDiagnostic[]=[];
562
579
if(usesUnsupportedFeatures.size){
563
-
resolveWarnings.push(l10n.t('The schema uses meta-schema features ({0}) that are not yet supported by the validator.',Array.from(usesUnsupportedFeatures.keys()).join(', ')));
580
+
resolveWarnings.push(toDiagnostic(l10n.t('The schema uses meta-schema features ({0}) that are not yet supported by the validator.',Array.from(usesUnsupportedFeatures.keys()).join(', ')),ErrorCode.SchemaUnsupportedFeature));
assert.strictEqual(resolvedSchema?.errors[0],"Problems loading reference 'http://myschemastore/myschemafoo': Unable to load schema from 'http://myschemastore/myschemafoo': Resource not found.");
1082
+
assert.deepStrictEqual(resolvedSchema?.errors,[{message: "Problems loading reference 'http://myschemastore/myschemafoo': Unable to load schema from 'http://myschemastore/myschemafoo': Resource not found.",code: ErrorCode.SchemaResolveError}]);
0 commit comments