Skip to content

Commit

Permalink
tests/test_schema_integrity.py: Add test_meta_schema_references
Browse files Browse the repository at this point in the history
  • Loading branch information
duncandewhurst committed Dec 5, 2024
1 parent 017232e commit 7506291
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/test_schema_integrity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import json
import os.path
import os
import sys

import jsonref
Expand Down Expand Up @@ -38,3 +38,16 @@ def test_meta_schema_is_in_sync():
actual = json.load(f)

assert actual == get_metaschema(), "Run: python manage.py pre-commit"


def test_meta_schema_references():
with open("schema/meta-schema.json") as f:
metaschema = json.load(f)

for file_name in os.listdir("schema"):
if file_name.endswith("-schema.json") and "meta-schema" not in file_name:
file_path = os.path.join("schema", file_name)
with open(file_path) as f:
schema = json.load(f)

assert schema["$schema"] == metaschema["id"], f"Incorrect $schema in {file_name}: {schema['$schema']}"

0 comments on commit 7506291

Please sign in to comment.