File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -610,6 +610,11 @@ function validate(
610610 return ;
611611 }
612612
613+ // schema should be an Object
614+ if ( typeof schema !== 'object' ) {
615+ return ;
616+ }
617+
613618 if ( ! schema . url ) {
614619 schema . url = originalSchema . url ;
615620 }
Original file line number Diff line number Diff line change @@ -379,7 +379,7 @@ export class YAMLSchemaService extends JSONSchemaService {
379379 const highestPrioSchemas = this . highestPrioritySchemas ( schemas ) ;
380380 const schemaHandle = super . createCombinedSchema ( resource , highestPrioSchemas ) ;
381381 return schemaHandle . getResolvedSchema ( ) . then ( ( schema ) => {
382- if ( schema . schema && typeof schema . schema !== 'string ') {
382+ if ( schema . schema && typeof schema . schema === 'object ') {
383383 schema . schema . url = schemaHandle . url ;
384384 }
385385
Original file line number Diff line number Diff line change @@ -1560,6 +1560,15 @@ obj:
15601560 } ) ;
15611561
15621562 describe ( 'Bug fixes' , ( ) => {
1563+ it ( 'should handle "additionalItems" not schema or boolean' , async ( ) => {
1564+ const schema = 'Foo' ;
1565+ languageService . addSchema ( SCHEMA_ID , schema as JSONSchema ) ;
1566+ const content = `foo: bar` ;
1567+ const result = await parseSetup ( content ) ;
1568+ expect ( result ) . to . be . empty ;
1569+ expect ( telemetry . messages ) . to . be . empty ;
1570+ } ) ;
1571+
15631572 it ( 'should handle bad schema refs' , async ( ) => {
15641573 const schema = {
15651574 type : 'object' ,
You can’t perform that action at this time.
0 commit comments