Skip to content

Commit

Permalink
Remove the added argument to jsonschema.validators.create. julian@Airm ●
Browse files Browse the repository at this point in the history
We need a better public API for vocabularies, and this unfortunately
won't cut it.

For now this is dirty, but works to load all vocabularies (which
are just concatenated together).

The reason this is needed is because I don't see a PEP302-compliant
way to load a whole directory using the importlib.resources APIs
(which call directories 'packages') -- and doing so manually would
break importing jsonschema via a zip file, which is something
historically that users were doing.
  • Loading branch information
Julian committed Sep 29, 2021
1 parent 1790fcc commit 38b4c60
Show file tree
Hide file tree
Showing 17 changed files with 9 additions and 615 deletions.
13 changes: 0 additions & 13 deletions jsonschema/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,6 @@ def load_schema(name):
return json.loads(data.decode("utf-8"))


def load_vocabulary(name):
"""
Load all schema files from ./schemas/``name`` and return them as a list.
"""
vocabulary = []
base_path = os.path.dirname(sys.modules["jsonschema"].__file__)
pathlist = Path(os.path.join(base_path, "schemas", name)).glob("*.json")
for path in pathlist:
with open(path) as data:
vocabulary.append(json.load(data))
return vocabulary


def format_as_index(container, indices):
"""
Construct a single string containing indexing operations for the indices.
Expand Down
56 changes: 0 additions & 56 deletions jsonschema/schemas/draft2019-09/applicator.json

This file was deleted.

17 changes: 0 additions & 17 deletions jsonschema/schemas/draft2019-09/content.json

This file was deleted.

57 changes: 0 additions & 57 deletions jsonschema/schemas/draft2019-09/core.json

This file was deleted.

14 changes: 0 additions & 14 deletions jsonschema/schemas/draft2019-09/format.json

This file was deleted.

29 changes: 0 additions & 29 deletions jsonschema/schemas/draft2019-09/hyper-schema.json

This file was deleted.

37 changes: 0 additions & 37 deletions jsonschema/schemas/draft2019-09/meta-data.json

This file was deleted.

98 changes: 0 additions & 98 deletions jsonschema/schemas/draft2019-09/validation.json

This file was deleted.

48 changes: 0 additions & 48 deletions jsonschema/schemas/draft2020-12/applicator.json

This file was deleted.

Loading

0 comments on commit 38b4c60

Please sign in to comment.