File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " vscode-json-languageservice" ,
3- "version" : " 5.3.7 " ,
3+ "version" : " 5.3.8 " ,
44 "description" : " Language service for JSON" ,
55 "main" : " ./lib/umd/jsonLanguageService.js" ,
66 "typings" : " ./lib/umd/jsonLanguageService" ,
Original file line number Diff line number Diff line change @@ -390,6 +390,9 @@ export class JSONSchemaService implements IJSONSchemaService {
390390 const errorMessage = l10n . t ( 'Unable to load schema from \'{0}\'. No schema request service available' , toDisplayString ( url ) ) ;
391391 return this . promise . resolve ( new UnresolvedSchema ( < JSONSchema > { } , [ errorMessage ] ) ) ;
392392 }
393+ if ( url . startsWith ( 'http://json-schema.org/' ) ) {
394+ url = 'https' + url . substring ( 4 ) ; // always access json-schema.org with https. See https://github.com/microsoft/vscode/issues/195189
395+ }
393396 return this . requestService ( url ) . then (
394397 content => {
395398 if ( ! content ) {
Original file line number Diff line number Diff line change @@ -1976,4 +1976,29 @@ suite('JSON Schema', () => {
19761976
19771977 } ) ;
19781978
1979+ test ( 'access json-schema.org with https' , async function ( ) {
1980+ const httpUrl = "http://json-schema.org/schema" ;
1981+ const httpsUrl = "https://json-schema.org/schema" ;
1982+
1983+ const schemas : { [ uri : string ] : JSONSchema } = {
1984+ [ httpsUrl ] : {
1985+ type : 'object' ,
1986+ properties : {
1987+ bar : {
1988+ const : 3
1989+ }
1990+ }
1991+ }
1992+ } ;
1993+ const accesses : string [ ] = [ ] ;
1994+ const schemaRequestService = newMockRequestService ( schemas , accesses ) ;
1995+
1996+ const ls = getLanguageService ( { workspaceContext, schemaRequestService } ) ;
1997+
1998+ const testDoc = toDocument ( JSON . stringify ( { $schema : httpUrl , bar : 2 } ) ) ;
1999+ let validation = await ls . doValidation ( testDoc . textDoc , testDoc . jsonDoc ) ;
2000+ assert . deepStrictEqual ( validation . map ( v => v . message ) , [ 'Value must be 3.' ] ) ;
2001+ assert . deepStrictEqual ( [ httpsUrl ] , accesses ) ;
2002+ } ) ;
2003+
19792004} ) ;
You can’t perform that action at this time.
0 commit comments