Skip to content

Tests for dependentSchema and propertyDependencies with unevaluatedPro… #732

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

Merged
merged 7 commits into from
Apr 15, 2024

Conversation

Vinit-Pandit
Copy link
Contributor

adding tests for dependentSchema and propertyDependencie with unevaluatedProperties and additionalProperties
refer this issue #626

@Vinit-Pandit Vinit-Pandit requested a review from a team as a code owner April 11, 2024 03:07
Copy link
Member

@gregsdennis gregsdennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these need to be split up differently.

The thing we're testing here is additionalProperties and unevaluatedProperties. The tests should go in those files.

Also, we also need a dependentSchemas test for draft-next.

@Vinit-Pandit
Copy link
Contributor Author

Feww..! GREEN :)

@gregsdennis
Copy link
Member

The files look fine, but I think we need more test cases for each scenario. What does a passing instance look like? What if the nested subschemas themselves do declare properties? Etc.

@Vinit-Pandit
Copy link
Contributor Author

Please review this

@Vinit-Pandit Vinit-Pandit force-pushed the main2 branch 2 times, most recently from 97ca40d to 06892f5 Compare April 14, 2024 05:42
Copy link
Member

@gregsdennis gregsdennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we need a few new test scenarios that define foo as a property. Apply those changes to all drafts as well, please.

@Vinit-Pandit
Copy link
Contributor Author

Vinit-Pandit commented Apr 15, 2024

The files look fine, but I think we need more test cases for each scenario. What does a passing instance look like? What if the nested subschemas themselves do declare properties? Etc.

Got it! I misunderstood the test cases as a test. I'm really sorry about that. If I understand correctly, I should add more test cases that cover the inner schemas as well. Are the test cases I added before your this comment still fine to keep?

@Vinit-Pandit
Copy link
Contributor Author

This one

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

@gregsdennis
Copy link
Member

I misunderstood the test cases as a test.

No, you didn't misunderstand. What you have is good, except for the test cases I commented on. For those, we need schemas like the one I showed.

You'll also need to rebase this branch since I merged another PR.

Copy link
Member

@gregsdennis gregsdennis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test scenarios look good to me. All the tests pass against my implementation. 🎉

Just a few descriptions to update. Thanks for the work on this.

@Vinit-Pandit
Copy link
Contributor Author

I just realize it after 5 commits that i can add the suggested changes in batch and then commit them in once 😅 , should i squash them into once ?

@gregsdennis gregsdennis merged commit fa9224d into json-schema-org:main Apr 15, 2024
1 check passed
@Vinit-Pandit Vinit-Pandit deleted the main2 branch April 18, 2024 03:35
@Vinit-Pandit Vinit-Pandit restored the main2 branch April 18, 2024 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants