devtools: Add doc JSON schema checks and formatting to pre-commit.
What changed, and why it matters
This commit only adds new pre-commit checks for JSON documentation files. It validates that JSON schema files in the doc/schemas directory follow a defined schema and are consistently formatted. There is no change to application code, no bug fix, and no security-related behavior change.
No security action required. Treat as a normal developer-tooling/CI hygiene change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch extends .pre-commit-config.yaml with three hooks: check-jsonschema against doc/rpc-schema-draft.json, check-metaschema for JSON Schema meta-validation, and pretty-format-json for formatting. These hooks operate only on files matching ^doc/schemas/.*.json$. No runtime code, protocol logic, or configuration handling is modified.
Changed components
.pre-commit-config.yamldoc/schemas/*.json (validation/formatting only)Inspect captured patch +23 / −0
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7a99d261..31d99aee 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -18,6 +18,29 @@ repos:
- id: shellcheck
args: [ -fgcc ]
+- repo: https://github.com/python-jsonschema/check-jsonschema
+ rev: 0.30.0
+ hooks:
+ - id: check-jsonschema
+ name: check doc JSON schemas
+ args: ["--schemafile", "doc/rpc-schema-draft.json"]
+ files: ^doc/schemas/.*\.json$
+ types: [ json ]
+
+ - id: check-metaschema
+ name: check doc JSON metaschemas
+ args: ["--verbose"]
+ files: ^doc/schemas/.*\.json$
+ types: [ json ]
+
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v5.0.0
+ hooks:
+ - id: pretty-format-json
+ args: [ "--indent", "2", "--no-sort-keys" ]
+ files: ^doc/schemas/.*\.json$
+ types: [ json ]
+
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.