-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validate_json_schema function to utils, refactored implementation
- Loading branch information
1 parent
7791bd4
commit 199aeaa
Showing
3 changed files
with
27 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ pytest-coverage.txt | |
.coverage | ||
.pytest_cache | ||
.DS_Store | ||
__pycache__/ | ||
__pycache__/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
import json | ||
|
||
import jsonschema | ||
|
||
|
||
def open_json(file_path): | ||
with open(file_path) as fp: | ||
return json.load(fp) | ||
|
||
|
||
def validate_json_schema(json_data, dataset_schema): | ||
try: | ||
jsonschema.validate(json_data, schema=dataset_schema) | ||
assert False | ||
except jsonschema.ValidationError as e: | ||
error_message = f"error: {e.message}. offending element: {e.json_path}" | ||
print(error_message) | ||
assert True |
199aeaa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report