microsoft/vscode

[json] Improve combining schemas not working with 'additionalProperties: false'

aeschli opened this issue · 4 comments

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"
                }
            }
        }

    ]
}

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.

There's now unevaluatedProperties added in schema 2019-09 as a solution to this. Supported in VS Code 1.68

image

🤔

It's working in May 2022, thus the milestone