Skip to content

Commit

Permalink
Added test for JSON Schema validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav committed Sep 16, 2021
1 parent ab57147 commit e409986
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ python-dotenv = "*" # For reading .env files.
mike = "*"
mkdocs-material = "*"
assertpy = "*"
jsonschema = "*"

[pipenv]
allow_prereleases = true # added by migration to linkml model template
Expand Down
7 changes: 6 additions & 1 deletion tests/test_validate_artifacts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import json
import os.path
import unittest
from assertpy import assert_that
from assertpy import assert_that, fail
import jsonschema

MODEL_PATH = 'crdch_model'

Expand All @@ -19,4 +20,8 @@ def test_validate_json_schema(self):
json_schema = json.load(f)
assert_that(json_schema).is_not_empty()

try:
jsonschema.Draft7Validator.check_schema(json_schema)
except jsonschema.exceptions.SchemaError as e:
fail(f'JSON Schema {json_schema_file_path} is not valid: {e}')

0 comments on commit e409986

Please sign in to comment.