Skip to content

Commit

Permalink
feat: #comment updated metaschema and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scrthq committed Nov 3, 2024
1 parent d05d3f9 commit 18194cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion schema/core-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "SC-DEX Core Schema",
"description": "Schema for structured, machine-readable supply chain data.",
"type": "object",
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/test_scdex_schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import jsonschema
import pytest
from jsonschema import validate, Draft7Validator
from jsonschema import validate, Draft202012Validator
from scdex import SCDEX_JSON_SCHEMA, SCDEX_SCHEMA_REPO_ROOT


Expand All @@ -12,7 +12,7 @@ def test_schema_is_resolved():
assert isinstance(SCDEX_JSON_SCHEMA, dict)
assert SCDEX_JSON_SCHEMA['title'] == 'SC-DEX Core Schema'

assert Draft7Validator.check_schema(SCDEX_JSON_SCHEMA) is None
assert Draft202012Validator.check_schema(SCDEX_JSON_SCHEMA) is None


@pytest.mark.parametrize("path_to_validate", examples_path.glob("valid/*.json"))
Expand All @@ -21,7 +21,7 @@ def test_valid_examples(path_to_validate):
with open(path_to_validate, 'r') as f:
data = f.read()
data = json.loads(data)
validate(data, SCDEX_JSON_SCHEMA, cls=Draft7Validator)
validate(data, SCDEX_JSON_SCHEMA, cls=Draft202012Validator)


@pytest.mark.parametrize("path_to_validate", examples_path.glob("invalid/*.json"))
Expand All @@ -31,4 +31,4 @@ def test_invalid_examples(path_to_validate):
data = f.read()
data = json.loads(data)
with pytest.raises(jsonschema.exceptions.ValidationError):
validate(data, SCDEX_JSON_SCHEMA, cls=Draft7Validator)
validate(data, SCDEX_JSON_SCHEMA, cls=Draft202012Validator)

0 comments on commit 18194cb

Please sign in to comment.