Skip to content

Commit

Permalink
Fixed yaml-language-server#72
Browse files Browse the repository at this point in the history
  • Loading branch information
JPinkney committed Jun 6, 2018
1 parent c7a0e5b commit 6830f57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/languageservice/parser/yamlParser.ts
Expand Up @@ -158,7 +158,7 @@ function recursivelyBuildAst(parent: ASTNode, node: Yaml.YAMLNode): ASTNode {

switch (type) {
case Yaml.ScalarType.null: {
return new NullASTNode(parent, name, instance.startPosition, instance.endPosition);
return new StringASTNode(parent, name, false, instance.startPosition, instance.endPosition);
}
case Yaml.ScalarType.bool: {
return new BooleanASTNode(parent, name, Yaml.parseYamlBoolean(value), node.startPosition, node.endPosition)
Expand Down
8 changes: 8 additions & 0 deletions test/schemaValidation.test.ts
Expand Up @@ -96,6 +96,14 @@ suite("Validation Tests", () => {
}).then(done, done);
});

it('Null scalar value should be treated as string', (done) => {
let content = `cwd: Null`;
let validator = parseSetup(content);
validator.then(function(result){
assert.equal(result.length, 0);
}).then(done, done);
});

it('Anchor should not not error', (done) => {
let content = `default: &DEFAULT\n name: Anchor\nanchor_test:\n <<: *DEFAULT`;
let validator = parseSetup(content);
Expand Down

0 comments on commit 6830f57

Please sign in to comment.