Skip to content

Commit

Permalink
CI: Validate json files against schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jcfr committed Apr 23, 2024
1 parent d75a8f1 commit 8528901
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,12 @@ repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.28.0"
hooks:
- id: check-jsonschema
files: ^[^/]*\.json$
args:
[
"--schemafile",
"schemas/slicer-extension-catalog-entry-schema-v1.0.0.json",
]
- id: check-dependabot
- id: check-github-workflows
58 changes: 58 additions & 0 deletions schemas/slicer-extension-catalog-entry-schema-v1.0.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://raw.githubusercontent.com/Slicer/Slicer/main/Schemas/slicer-extension-catalog-item-schema-v1.0.0.json#",
"type": "object",
"title": "3D Slicer extensions catalog entry schema",
"description": "Schema for storing information about a 3D Slicer extension to allow it to be listed in the extension catalog.",
"required": ["$schema", "category", "scm_url"],
"additionalProperties": true,
"properties": {
"@schema": {
"$id": "#schema",
"type": "string",
"title": "Schema",
"description": "URL of versioned schema."
},
"category": {
"$id": "#category",
"type": "string",
"title": "Category used to organize the extension in the extension catalog."
},
"scm_url": {
"$id": "#scm_url",
"type": "string",
"title": "Filename or URL of the repository."
},
"scm_revision": {
"$id": "#scm_revision",
"type": "string",
"title": "Hash, branch or tag name to identify the revision within the repository."
},
"scm_type": {
"$id": "#scm_type",
"type": "string",
"title": "Type of revision control system.",
"enum": ["git", "local"],
"default": "git"
},
"build_dependencies": {
"$id": "#build_dependencies",
"type": "array",
"title": "List of extensions required to build this extension.",
"additionalItems": false,
"items": { "type": "string" }
},
"build_subdirectory": {
"$id": "#build_subdirectory",
"type": "string",
"title": "Name of the inner build directory in case of superbuild based extension.",
"default": "."
},
"enabled": {
"$id": "#enabled",
"type": "boolean",
"title": "Specify if the extension should be enabled after its installation.",
"default": true
}
}
}
1 change: 1 addition & 0 deletions scripts/check_filenames.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ unexpected_files=$(find . -mindepth 1 \( -type d \( \
-path ./.github -o \
-path ./.git -o \
-path ./ARCHIVE -o \
-path ./schemas -o \
-path ./scripts \
\) -o -type f \( \
-name .pre-commit-config.yaml -o \
Expand Down

0 comments on commit 8528901

Please sign in to comment.