From 761d5f392bbed7fe9386d5a64df1360cb31d8a99 Mon Sep 17 00:00:00 2001 From: Rui <102453770+ruixhuang@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:59:48 -0700 Subject: [PATCH] TRCL-2832: Add script to validate JSON files (#92) * Add script to validate JSON files * Test failure cases * Revert "Test failure cases" This reverts commit 8251a8594c651534491f87ea0e1a779c6917116a. --- scripts/ci_validate_json_files.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 scripts/ci_validate_json_files.sh diff --git a/scripts/ci_validate_json_files.sh b/scripts/ci_validate_json_files.sh new file mode 100755 index 000000000..24d181859 --- /dev/null +++ b/scripts/ci_validate_json_files.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +json_files=$(find . -name "*.json") + +# Validate JSON files +for file in $json_files +do + echo "Validating $file" + result=`python -m json.tool $file` + if [ $? -ne 0 ]; then + echo "Invalid JSON file: $file" + exit 1 + fi +done \ No newline at end of file