Skip to content

dependentSchemas and propertyDependencies don't "define" properties #626

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

Closed
gregsdennis opened this issue Dec 14, 2022 · 6 comments
Closed
Labels
enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). missing test A request to add a test to the suite that is currently not covered elsewhere.

Comments

@gregsdennis
Copy link
Member

Coming out of a Slack discussion and #624, we need tests that show that properties listed in dependentSchemas and propertyDependencies don't affect the validation results of additionalProperties or unevaluatedProperties.

@Julian Julian added missing test A request to add a test to the suite that is currently not covered elsewhere. enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). labels Dec 14, 2022
@Vinit-Pandit
Copy link
Contributor

@gregsdennis Can you please check if this test matches the requirements for this issue?

[
    {
        "description": "dependent schema with additionalProperties",
        "schema": {
            "$schema": "https://json-schema.org/draft/2019-09/schema",
            "dependentSchemas": {
                "foo": {}
            },
            "additionalProperties": false
        },
        "tests": [
            {
                "description": "dependentSchemas properties are counted as additional properties",
                "data": {
                    "foo": ""
                },
                "valid": false
            }
        ]
    },
    {
        "description": "dependent schema with unevaluatedProperties",
        "schema": {
            "$schema": "https://json-schema.org/draft/2019-09/schema",
            "dependentSchemas": {
                "foo": {}
            },
            "unevaluatedProperties": false
        },
        "tests": [
            {
                "description": "dependentSchemas properties are counted as unevaluated properties",
                "data": {
                    "foo": ""
                },
                "valid": false
            }
        ]
    }
]

@gregsdennis
Copy link
Member Author

Yeah, those should do. We'll need similar tests for the new propertyDependencies in draft/next.

@Vinit-Pandit
Copy link
Contributor

Vinit-Pandit commented Apr 6, 2024

@gregsdennis ?

[{
        "description" : "propertyDependencies with additionalProperties",
        "schema" : {
            "propertyDependencies" : {
                "foo" : {}
            },
            "additionalProperties" : false
        },
        "tests" : [
            {
                "description": "propertyDependencies properties are count as additionalproperties" , 
                "data" : {"foo" : ""},
                "valid" : false
            }
        ]
    },
    {
        "description" : "propertyDependencies with unevaluatedProperties" ,
        "schema" : {
            "propertyDependencies" : {
                "foo" : {}
            },
            "unevaluatedProperties" : false
        },

        "test" : [
            {
                "description": "propertyDependencies properties are count as the unevaluatedProperties" , 
                "data": {"foo": ""},
                "valid": false
            }
        ]
    }]

@Vinit-Pandit
Copy link
Contributor

Is this test also require for dependentSchemas in draft/next or this behaviour is going to be change in next ?

@Vinit-Pandit
Copy link
Contributor

@gregsdennis i think this one need to be close as it done in #732

@gregsdennis
Copy link
Member Author

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement to the tooling or structure of the suite (as opposed to a new test). missing test A request to add a test to the suite that is currently not covered elsewhere.
Projects
None yet
Development

No branches or pull requests

3 participants