[json] Improve combining schemas not working with 'additionalProperties: false'
aeschli opened this issue · 4 comments
aeschli commented
When combining schemas such as when multiple extensions have schemas for package.json we use 'allOf' to combine.
This works well as long as none of the schemas uses additionalProperties: false.
{
"allOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"bar": {
"description": "bar"
},
"foo": {
"description": "foo" }
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"xoo": {
"description": "xoo"
}
}
}
]
}
HIAB-vesteel commented
I believe this is the correct functionality of JSON Schema.
When adding "additionalProperties": false, in combination of "allOf" it will not validate. When the first schema is validated in allOf it will fail as there are additionalProperties. After this the allOf validation is done.
This issue should probably be closed.
aeschli commented
There's now unevaluatedProperties
added in schema 2019-09 as a solution to this. Supported in VS Code 1.68
bpasero commented
aeschli commented
It's working in May 2022, thus the milestone