vscode-yaml
vscode-yaml copied to clipboard
Possible bug in allOf processing
Describe the bug
vscode linter shows an incorrect message of "Property x is not allowed" if the property is defined in an object referenced in an allOf statement
Expected Behavior
o3:
p1: www
p2: 2
p3: false
validator shouldn't show errors (Property p1 is not allowed, Property p2 is not allowed, Property p3 is not allowed)
for this schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"definitions": {
"o1": {
"type": "object",
"properties": {
"p1": {
"type": "string"
},
"p2": {
"type": "number"
}
},
"required": [
"p1",
"p2"
]
},
"o2": {
"type": "object",
"properties": {
"p3": {
"type": "boolean"
}
},
"required": [
"p3"
]
}
},
"properties": {
"o3": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/o1"
},
{
"$ref": "#/definitions/o2"
}
]
}
},
"required": [
"o3"
]
}
Current Behavior
The validator shows the manifest as incorrect.
Steps to Reproduce
- Define the schema an associate it to the manifest a.test.yaml
- fill the manifest with the above manifest example
- check the errors
Environment
- [ ] Windows
- [ ] Mac
- [X ] Linux
- [ ] other (please specify)
This is from the output (YAML Support)
[Trace - 5:40:41 PM] Received response 'textDocument/codeAction - (55)' in 4ms.
Result: [
{
"title": "Jump to schema location (test.json)",
"command": {
"title": "JumpToSchema",
"command": "jumpToSchema",
"arguments": [
"https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
]
},
"diagnostics": [
{
"range": {
"start": {
"line": 3,
"character": 2
},
"end": {
"line": 3,
"character": 4
}
},
"message": "Property p3 is not allowed.",
"data": {
"schemaUri": [
"https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
]
},
"code": 0,
"severity": 1,
"source": "yaml-schema: test"
}
]
}
]
[Trace - 5:42:40 PM] Received response 'textDocument/codeAction - (57)' in 1ms.
Result: [
{
"title": "Jump to schema location (test.json)",
"command": {
"title": "JumpToSchema",
"command": "jumpToSchema",
"arguments": [
"https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
]
},
"diagnostics": [
{
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 1,
"character": 4
}
},
"message": "Property p1 is not allowed.",
"data": {
"schemaUri": [
"https://jschemas-gnx-ssp-r01a-id.apps.ocp-ges-pub-01.ocp.ms//schemas/arq-mss-r01/v1/std/test.json"
]
},
"code": 0,
"severity": 1,
"source": "yaml-schema: test"
}
]
}
]