redhat-developer / redhat-developer/vscode-yaml
A couple cases where vscode's YAML validation is failing but JSON validation is succeeding
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Describe the bug
I've got a couple schema patterns for creating exclusive-or (xor) and optional-exclusive-or (oxor) constraints for object parameters. When validating JSONs in vscode, they're both successfully showing errors when conflicting parameter names exist, but neither of them are doing so when validating YAMLs with the same parameter conflicts.
Example xor:
{
"type": "object",
"if": { "propertyNames": { "enum": ["a", "b", "c"] }, "minProperties": 2 },
"then": false,
"else": {
"oneOf": [
{
"required": ["a"]
},
{
"required": ["b"]
},
{
"required": ["c"]
}
]
},
"properties": { "a": { "type": "string" }, "b": { "type": "number" }, "c": { "type": "boolean" }, "d": { "type": "null" } },
"additionalProperties": false
}
Example oxor:
{
"type": "object",
"oneOf": [
{ "required": ["a"] },
{ "required": ["b"] },
{ "required": ["c"] },
{
"not": {
"oneOf": [
{ "required": ["a"] },
{ "required": ["b"] },
{ "required": ["c"] },
{ "required": ["a", "b"] },
{ "required": ["a", "c"] },
{ "required": ["b", "c"] }
]
}
}
],
"properties": { "a": { "type": "string" }, "b": { "type": "number" }, "c": { "type": "boolean" }, "d": { "type": "null" } },
"additionalProperties": false
}
Expected Behavior
The xor pattern above should show an error when either:
- None of a, b, or c exist
- If more than one of the above exists
The oxor pattern above should show an error when more than one of a, b, or c exists.
Current Behavior
The xor is showing an error when none exist, but isn't showing errors for conflicts when multiple exist.
The oxor isn't showing errors when multiple exist.
Steps to Reproduce
- Try it out with a JSON, then try it with a YAML :P
Environment
- Windows
- Mac
- Linux
- other (please specify)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Reproduce the two schema patterns in VS Code with equivalent JSON and YAML inputs, then trace the YAML validation path and compare handling of if/then/else, oneOf, required, and not. Done means YAML reports the same XOR and optional-XOR conflicts as JSON, with regression coverage added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100