Skip to content

Commit

Permalink
Merge pull request redhat-developer#20 from JPinkney/master
Browse files Browse the repository at this point in the history
Fixed issue where nodes with additionalProperties would error in specific cases
  • Loading branch information
JPinkney authored Jun 22, 2017
2 parents d05d950 + 1615636 commit fc2255d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions server/src/languageService/services/schemaValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down

0 comments on commit fc2255d

Please sign in to comment.