Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aeschli opened this issue Feb 8, 2017 · 4 comments
Closed
Assignees
Labels
feature-request Request for new features or functionality json JSON support issues
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Feb 8, 2017

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
Copy link

HIAB-vesteel commented Jun 13, 2019

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
Copy link
Contributor Author

aeschli commented Jun 10, 2022

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

@aeschli aeschli modified the milestones: Backlog, May 2022 Jun 10, 2022
@bpasero bpasero modified the milestones: May 2022, August 2022 Aug 2, 2022
@bpasero
Copy link
Member

bpasero commented Aug 2, 2022

image

🤔

@aeschli
Copy link
Contributor Author

aeschli commented Aug 22, 2022

It's working in May 2022, thus the milestone

@aeschli aeschli closed this as completed Aug 22, 2022
@aeschli aeschli modified the milestones: August 2022, May 2022 Aug 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality json JSON support issues
Projects
None yet
Development

No branches or pull requests

3 participants