Skip to content

Commit 4ecee3c

Browse files
committed
Add validation make targets
1 parent 635ab7e commit 4ecee3c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.PHONY: validate validate-json validate-control-plane
2+
3+
validate: validate-json validate-control-plane
4+
5+
validate-json:
6+
python3 - <<'PY'
7+
import json
8+
import pathlib
9+
import sys
10+
11+
failed = False
12+
for root in (pathlib.Path('schemas'), pathlib.Path('examples')):
13+
if not root.exists():
14+
continue
15+
for path in sorted(root.rglob('*.json')):
16+
try:
17+
json.loads(path.read_text())
18+
except Exception as exc:
19+
print(f'{path}: invalid JSON: {exc}', file=sys.stderr)
20+
failed = True
21+
if failed:
22+
raise SystemExit(1)
23+
print('JSON syntax validated.')
24+
PY
25+
26+
validate-control-plane:
27+
python3 tools/validate_control_plane_examples.py

0 commit comments

Comments
 (0)