Repository: python-jsonschema/check-jsonschema

Issue:
Output of all validated files if verbose: true
I would love to see in the output a list of those files that been picked up by your tool and validated.
Maybe it's already possible. I am a new user. 


Comments:

Patch:
diff --git a/.github/workflows/publish_to_pypi.yaml b/.github/workflows/publish_to_pypi.yaml
index 1177fff..8872066 100644
--- a/.github/workflows/publish_to_pypi.yaml
+++ b/.github/workflows/publish_to_pypi.yaml
@@ -57,4 +57,4 @@ jobs:
         env:
           GH_TOKEN: ${{ github.token }}
           GH_REPO: ${{ github.repository }}
-        run: gh release upload "${{ github.ref }}" dist/*
+        run: gh release upload "${{ github.ref_name }}" dist/*
diff --git a/src/check_jsonschema/checker.py b/src/check_jsonschema/checker.py
index 28931d5..daa4f85 100644
--- a/src/check_jsonschema/checker.py
+++ b/src/check_jsonschema/checker.py
@@ -71,6 +71,8 @@ class SchemaChecker:
                 validator = self.get_validator(path, data)
                 for err in validator.iter_errors(data):
                     result.record_validation_error(path, err)
+                else:
+                    result.record_validation_success(path)
         return result
 
     def _run(self) -> None:
diff --git a/src/check_jsonschema/reporter.py b/src/check_jsonschema/reporter.py
index 3303ae1..453dd9d 100644
--- a/src/check_jsonschema/reporter.py
+++ b/src/check_jsonschema/reporter.py
@@ -24,7 +24,7 @@ class Reporter(abc.ABC):
         super().__init__(**kwargs)
 
     @abc.abstractmethod
-    def report_success(self) -> None:
+    def report_success(self, result: CheckResult) -> None:
         raise NotImplementedError
 
     @abc.abstractmethod
@@ -33,7 +33,7 @@ class Reporter(abc.ABC):
 
     def report_result(self, result: CheckResult) -> None:
         if result.success:
-            self.report_success()
+            self.report_success(result)
         else:
             self.report_errors(result)
 
@@ -51,11 +51,15 @@ class TextReporter(Reporter):
     def _echo(self, s: str, *, indent: int = 0) -> None:
         click.echo(" " * indent + s, file=self.stream)
 
-    def report_success(self) -> None:
+    def report_success(self, result: CheckResult) -> None:
         if self.verbosity < 1:
             return
         ok = click.style("ok", fg="green")
         self._echo(f"{ok} -- validation done")
+        if self.verbosity > 1:
+            self._echo("The following files were checked:")
+            for filename in result.successes:
+                self._echo(f"  {filename}")
 
     def _format_validation_error_message(
         self, err: jsonschema.ValidationError, filename: str | None = None
@@ -140,10 +144,12 @@ class JsonReporter(Reporter):
         else:
             click.echo(json.dumps(data, separators=(",", ":")))
 
-    def report_success(self) -> None:
+    def report_success(self, result: CheckResult) -> None:
         report_obj: dict[str, t.Any] = {"status": "ok"}
         if self.verbosity > 0:
             report_obj["errors"] = []
+        if self.verbosity > 1:
+            report_obj["checked_paths"] = list(result.successes)
         self._dump(report_obj)
 
     def _dump_error_map(
@@ -192,6 +198,8 @@ class JsonReporter(Reporter):
 
     def report_errors(self, result: CheckResult) -> None:
         report_obj: dict[str, t.Any] = {"status": "fail"}
+        if self.verbosity > 1:
+            report_obj["checked_paths"] = list(result.successes)
         if self.verbosity > 0:
             report_obj["errors"] = list(self._dump_error_map(result.validation_errors))
             report_obj["parse_errors"] = list(
diff --git a/src/check_jsonschema/result.py b/src/check_jsonschema/result.py
index 31a021c..0ac651a 100644
--- a/src/check_jsonschema/result.py
+++ b/src/check_jsonschema/result.py
@@ -9,11 +9,15 @@ class CheckResult:
     def __init__(self) -> None:
         self.validation_errors: dict[str, list[jsonschema.ValidationError]] = {}
         self.parse_errors: dict[str, list[ParseError]] = {}
+        self.successes: list[str] = []
 
     @property
     def success(self) -> bool:
         return not (bool(self.parse_errors) or bool(self.validation_errors))
 
+    def record_validation_success(self, path: pathlib.Path) -> None:
+        self.successes.append(str(path))
+
     def record_validation_error(
         self, path: pathlib.Path, err: jsonschema.ValidationError
     ) -> None:


Test patch:
diff --git a/tests/unit/test_reporters.py b/tests/unit/test_reporters.py
index cdeef35..b02fed7 100644
--- a/tests/unit/test_reporters.py
+++ b/tests/unit/test_reporters.py
@@ -1,4 +1,5 @@
 import json
+import textwrap
 
 import pytest
 from jsonschema import Draft7Validator
@@ -8,7 +9,9 @@ from check_jsonschema.result import CheckResult
 
 
 def _make_success_result():
-    return CheckResult()
+    res = CheckResult()
+    res.successes.append("foo.json")
+    return res
 
 
 @pytest.mark.parametrize("verbosity", (0, 1, 2))
@@ -18,29 +21,41 @@ def test_text_format_success(capsys, verbosity, use_report_result_path):
     if use_report_result_path:
         reporter.report_result(_make_success_result())
     else:
-        reporter.report_success()
+        reporter.report_success(_make_success_result())
     captured = capsys.readouterr()
     assert captured.err == ""
     if verbosity == 0:
         assert captured.out == ""
-    else:
+    elif verbosity == 1:
         assert captured.out == "ok -- validation done\n"
+    else:
+        assert captured.out == textwrap.dedent(
+            """\
+            ok -- validation done
+            The following files were checked:
+              foo.json
+            """
+        )
 
 
-@pytest.mark.parametrize("verbosity", (0, 1))
+@pytest.mark.parametrize("verbosity", (0, 1, 2))
 @pytest.mark.parametrize("use_report_result_path", (False, True))
 def test_json_format_success(capsys, verbosity, use_report_result_path):
     reporter = JsonReporter(verbosity=verbosity, pretty=False)
     if use_report_result_path:
         reporter.report_result(_make_success_result())
     else:
-        reporter.report_success()
+        reporter.report_success(_make_success_result())
     captured = capsys.readouterr()
     assert captured.err == ""
     if verbosity == 0:
         assert captured.out == '{"status":"ok"}\n'
-    else:
+    elif verbosity == 1:
         assert captured.out == '{"status":"ok","errors":[]}\n'
+    else:
+        assert (
+            captured.out == '{"status":"ok","errors":[],"checked_paths":["foo.json"]}\n'
+        )
 
 
 def test_text_format_validation_error_message_simple():