2022-01-17 19:36:02 +00:00
|
|
|
#!/bin/bash
|
2021-10-31 11:20:08 +00:00
|
|
|
|
|
|
|
# Primitive testing script to check that the JSONs are valid.
|
|
|
|
|
2022-12-27 21:55:43 +00:00
|
|
|
if ! jq --version &> /dev/null; then
|
|
|
|
echo "You need to install jq to run this script"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-10-31 11:20:08 +00:00
|
|
|
ret=0
|
2023-01-29 12:41:41 +00:00
|
|
|
|
|
|
|
for file in *.json; do
|
|
|
|
if ! jq --exit-status '.route | .[] | .device' < "$file" > /dev/null 2>&1
|
2021-10-31 11:20:08 +00:00
|
|
|
then
|
2023-01-29 12:41:41 +00:00
|
|
|
echo "$file is invalid." >&2
|
2021-10-31 11:20:08 +00:00
|
|
|
ret=1
|
|
|
|
else
|
2023-01-29 12:41:41 +00:00
|
|
|
#echo "$file is valid."
|
2021-10-31 11:34:20 +00:00
|
|
|
:
|
2021-10-31 11:20:08 +00:00
|
|
|
fi
|
2023-01-29 12:41:41 +00:00
|
|
|
done
|
2021-10-31 11:20:08 +00:00
|
|
|
|
2021-10-31 11:34:20 +00:00
|
|
|
exit $ret
|