misp-objects/jq_all_the_things.sh

29 lines
779 B
Bash
Raw Normal View History

2017-02-13 11:15:51 +01:00
#!/bin/bash
2019-01-28 16:06:05 +01:00
# Seeds sponge, from moreutils
#Validate all Jsons first
for dir in `find . -name "*.json"`
do
echo validating ${dir}
# python3 -c "import json; f_in = open('${dir}'); data = json.load(f_in); f_in.close(); f_out = open('${dir}', 'w'); json.dump(data, f_out, indent=2, sort_keys=True, ensure_ascii=False); f_out.close();"
cat ${dir} | jq . >/dev/null
rc=$?
if [[ $rc != 0 ]]; then exit $rc; fi
done
2017-02-13 11:15:51 +01:00
set -e
set -x
# Seeds sponge, from moreutils
2017-02-13 11:18:42 +01:00
for dir in objects/*/definition.json
2017-02-13 11:15:51 +01:00
do
2020-04-26 02:14:00 +02:00
cat ${dir} | jq -S -j . | sponge ${dir}
2017-02-13 11:15:51 +01:00
done
2020-04-26 03:02:02 +02:00
cat relationships/definition.json | jq -S -j . | sponge relationships/definition.json
2017-08-11 12:19:52 +02:00
cat schema_objects.json | jq . | sponge schema_objects.json
cat schema_relationships.json | jq . | sponge schema_relationships.json