I have rather complex JSON schema with which YAML plugin doesn't work correctly. It reports errors in valid YAML document. But when I use this schema with equivalent JSON document it works correctly.
I tried to simplify the schema and narrow the problem but it is still long and complex because the problem is in some combination of schema constructs.
I have vscode-yaml 0.0.4 with VSCode insider build (see bellow).
Here is the YAML document which doesn't work correctly:
aaa:
type: TypeA
properties:
propertyA: { stringArray: [ "abcd"] }
Here is JSON document which works:
{
"$schema": "./test.schema.json",
"aaa": {
"type": "TypeA",
"properties": {
"propertyA": {
"stringArray": ["abcd"]
}
}
}
}
Here is test.schema.json schema:
{
"$schema": "http://json-schema.org/schema#",
"type": "object",
"properties": {
"aaa": {
"oneOf": [
{
"allOf": [
{
"properties": {
"type": {
"enum": [
"TypeA"
]
},
"properties": {
"type": "object",
"properties": {
"propertyA": {
"$ref": "#/definitions/commonStructures",
"additionalProperties": false
}
},
"required": [
"propertyA"
],
"additionalProperties": true
}
},
"required": [
"type"
]
},
{
"$ref": "#/definitions/commonProperties"
}
]
},
{
"allOf": [
{
"properties": {
"type": {
"enum": [
"TypeB"
]
},
"properties": {
"type": "object",
"properties": {
"propertyB": {
"$ref": "#/definitions/commonStructures",
"additionalProperties": false
}
},
"required": [
"propertyB"
],
"additionalProperties": true
}
},
"required": [
"type"
]
},
{
"$ref": "#/definitions/commonProperties"
}
]
}
]
}
},
"required": [
"aaa"
],
"additionalProperties": true,
"definitions": {
"commonProperties": {
"type": "object",
"properties": {
"commonProperty": {
"type": "string"
}
}
},
"commonStructures": {
"type": "object",
"properties": {
"stringArray": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1
}
},
"additionalProperties": false
}
}
}
Extension|Author (truncated)|Version
---|---|---
vscode-yaml|red|0.0.4
I've narrowed this down to a regression in redhat-developer/yaml-language-server@2a8456a7e2e319aece0f9d05e5af087450cedf63 inside the jsonParser. I'm currently working on fixing this!
I think I'm meeting the same issue. I have a schema for a .travis.yml that defines the type of e.g. before_install as oneOf boolean, string or array of strings:
But the inside VS Code I get the validation error that boolean is expected (and not string array):

https://github.com/aaronpowell/ps-nvmw/blob/9784e5ada938a7485a6786371ac76b3ed78d37fb/.travis.yml#L13
I believe this is the same issue. I have a fix for it we just need to release the extension again for the update!
@JPinkney to make these releases automatic, would you be interested in a semantic-release auto-release workflow? I set that up for php-language-server and vscode-php-intellisense and it works very well
Hi, I've fixed this issue! It's now available in the latest release!
@JPinkney awesome! Did you read my comment above?
@JPinkney thanks, with latest release my schema works as expected.
BTW the schema is here: https://github.com/vojtechhabarta/heat-template-schema/blob/master/schema/heat-template.schema.json - it is generated schema for OpenStack Heat Orchestration Templates.
@vojtechhabarta I would encourage you to contribute it to jsonschemastore :)