Skip to content

Commit 3fe552d

Browse files
committed
test: add CI check for stale JSON schema
1 parent 090f291 commit 3fe552d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
from pathlib import Path
3+
4+
from dbt_jobs_as_code.schemas.config import generate_config_schema
5+
6+
SCHEMA_PATH = Path("src/dbt_jobs_as_code/schemas/load_job_schema.json")
7+
8+
9+
def test_json_schema_is_up_to_date():
10+
"""Ensure the committed JSON schema matches what the models generate.
11+
12+
If this fails, run: `dbt-jobs-as-code update-json-schema`
13+
"""
14+
committed = json.loads(SCHEMA_PATH.read_text())
15+
generated = json.loads(generate_config_schema())
16+
assert committed == generated, (
17+
"The committed JSON schema is out of date. "
18+
"Run `dbt-jobs-as-code update-json-schema` to regenerate it."
19+
)

0 commit comments

Comments
 (0)