From 161563647f4efbbc8ae4d767f1d152fbc5a4daa8 Mon Sep 17 00:00:00 2001 From: jpinkney Date: Thu, 22 Jun 2017 10:20:25 -0400 Subject: [PATCH] Fixed issue where additionalProperties would error in specific cases --- .../src/languageService/services/schemaValidator.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/languageService/services/schemaValidator.ts b/server/src/languageService/services/schemaValidator.ts index fc70f2d7..8c94bff3 100644 --- a/server/src/languageService/services/schemaValidator.ts +++ b/server/src/languageService/services/schemaValidator.ts @@ -161,10 +161,15 @@ export class YAMLSChemaValidator extends ASTVisitor { private hasAdditionalProperties(nodeValue: string): boolean { let schemaAtNode = this.kuberSchema["childrenNodes"][nodeValue]; - if(schemaAtNode[0].hasOwnProperty("additionalProperties")){ - return schemaAtNode[0]["additionalProperties"].hasOwnProperty("type") && schemaAtNode[0]["additionalProperties"].hasOwnProperty("description"); - } - return false; + let additionalPropertyCount = 0; + + schemaAtNode.forEach(element => { + if(element.hasOwnProperty("additionalProperties") && element["additionalProperties"].hasOwnProperty("type") && element["additionalProperties"].hasOwnProperty("description")){ + additionalPropertyCount += 1; + } + }); + + return additionalPropertyCount !== 0; } public getErrorResults(){