Skip to content

Expected validator_for usage #490

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
manycoding opened this issue Nov 13, 2018 · 2 comments
Closed

Expected validator_for usage #490

manycoding opened this issue Nov 13, 2018 · 2 comments

Comments

@manycoding
Copy link

manycoding commented Nov 13, 2018

Hello, I am not sure if I do it correctly, but here's what it looks like:

from jsonschema import validators

validator = validators.validator_for(schema)(schema)
validator.check_schema(schema)

I want to infer a proper validator from a schema and verify if the schema is valid for the inferred validator.

@Julian
Copy link
Member

Julian commented Nov 13, 2018

That looks correct, though you don't need an instance, since check_schema is a classmethod. I.e. validator_for(schema).check_schema(schema).

Is there an error you're getting, or something specifically unclear about the docs?

@manycoding
Copy link
Author

manycoding commented Nov 15, 2018

No, I just was thinking that's quite funny to pass schema 3 times :) Well, now it's 2 times.
Thanks 👍

Julian added a commit that referenced this issue Jun 24, 2021
0aefbb3d Merge pull request #491 from jdesrosiers/object-contains-tests
336ef8d2 Merge pull request #452 from LeifRilbe/rilbe/propertyNames-with-pattern
2dfbc79c Simplify the test case names as well.
b6d0649d Add tests for contains with objects
da687ca5 Enforce a consistent code style for contains tests
b163efcf Merge pull request #490 from jdesrosiers/draft-future
7c8cb488 Initialize draft-future with 2020-12 tests
4d65d2df Merge pull request #483 from kylef/kylef/date
ee9dcaa7 Merge pull request #485 from marksparkza/contains-with-false-if
eaa5bffc Merge pull request #489 from json-schema-org/ether/more-recursiveRef
7c33b533 dynamic $recursiveRef test with cousin $recursiveAnchors
8a3a542b Fix invalid JSON error
8a89f58e Add tests combining remote refs and defs
3aec0d14 Add tests combining relative refs and defs
a107d196 fix: $defs -> definitions in draft 6,7 tests
0c223de2 Remove a test for undefined $id behavior
4efec180 Test that "contains" does not fail due to false "if" subschema
bf383b4c fix: make identifiers unique across tests
812f1f08 Merge pull request #484 from json-schema-org/ether/schemas-under-unknown-keywords
64f6b850 Test that identifiers are not found inside unrecognized keywords
c69a89c6 Stricter date format constraints
93193442 Test cases for propertyNames with pattern - update after PR feedback.
8e4aad95 Test cases for propertyNames with pattern.

git-subtree-dir: json
git-subtree-split: 0aefbb3d80e0caa22f3782677cf09c61b2205aa7
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

No branches or pull requests

2 participants