From e74b7bf405dbbd0cbde64b44c634bba65822baf9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:34:35 +0000 Subject: [PATCH 1/4] Initial plan From 9b07636c7ea1dd21c6771dfb06a1349b0cfabddc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:38:04 +0000 Subject: [PATCH 2/4] Add GitHub Actions workflow to validate JSON schema files on PRs Co-authored-by: rajeshsindhu <24849791+rajeshsindhu@users.noreply.github.com> --- .github/scripts/validate_json.py | 35 +++++++++++++++++++++++++++++ .github/workflows/validate-json.yml | 18 +++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/scripts/validate_json.py create mode 100644 .github/workflows/validate-json.yml diff --git a/.github/scripts/validate_json.py b/.github/scripts/validate_json.py new file mode 100644 index 0000000..b1b4215 --- /dev/null +++ b/.github/scripts/validate_json.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +"""Validate that all JSON files under the schema directory are well-formed.""" + +import json +import sys +from pathlib import Path + + +def validate_json_files(schema_dir: str) -> int: + """Validate every *.json file found under schema_dir. + + Returns 0 if all files are valid, 1 if any file is invalid. + """ + has_error = False + json_files = sorted(Path(schema_dir).rglob("*.json")) + + if not json_files: + print(f"No JSON files found under '{schema_dir}'.") + return 0 + + for filepath in json_files: + try: + with open(filepath, encoding="utf-8") as f: + json.load(f) + print(f"VALID: {filepath}") + except json.JSONDecodeError as exc: + print(f"INVALID: {filepath} — {exc}", file=sys.stderr) + has_error = True + + return 1 if has_error else 0 + + +if __name__ == "__main__": + directory = sys.argv[1] if len(sys.argv) > 1 else "schema" + sys.exit(validate_json_files(directory)) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml new file mode 100644 index 0000000..36364ec --- /dev/null +++ b/.github/workflows/validate-json.yml @@ -0,0 +1,18 @@ +name: Validate JSON Schema Files + +on: + pull_request: + paths: + - 'schema/**' + +jobs: + validate-json: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Validate JSON files in schema directory + run: python3 .github/scripts/validate_json.py schema From 7c6bc4cb452f9f956c927db6e639815be991df38 Mon Sep 17 00:00:00 2001 From: Rajesh Sindhu Date: Mon, 2 Mar 2026 14:12:00 -0800 Subject: [PATCH 3/4] Update .github/scripts/validate_json.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/scripts/validate_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/validate_json.py b/.github/scripts/validate_json.py index b1b4215..b4b82c3 100644 --- a/.github/scripts/validate_json.py +++ b/.github/scripts/validate_json.py @@ -23,7 +23,7 @@ def validate_json_files(schema_dir: str) -> int: with open(filepath, encoding="utf-8") as f: json.load(f) print(f"VALID: {filepath}") - except json.JSONDecodeError as exc: + except (json.JSONDecodeError, OSError, UnicodeDecodeError) as exc: print(f"INVALID: {filepath} — {exc}", file=sys.stderr) has_error = True From 0327e34a6325a444a9abb3e44203d0f8a4d003df Mon Sep 17 00:00:00 2001 From: Rajesh Sindhu Date: Mon, 2 Mar 2026 14:12:14 -0800 Subject: [PATCH 4/4] Update .github/workflows/validate-json.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/validate-json.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/validate-json.yml b/.github/workflows/validate-json.yml index 36364ec..a22bf8f 100644 --- a/.github/workflows/validate-json.yml +++ b/.github/workflows/validate-json.yml @@ -4,6 +4,8 @@ on: pull_request: paths: - 'schema/**' + - '.github/scripts/validate_json.py' + - '.github/workflows/validate-json.yml' jobs: validate-json: