Skip to content

Commit b3566f6

Browse files
committed
CI: Validate json files against schema
1 parent a70d952 commit b3566f6

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,12 @@ repos:
2828
- repo: https://github.com/python-jsonschema/check-jsonschema
2929
rev: "0.28.0"
3030
hooks:
31+
- id: check-jsonschema
32+
files: ^[^/]*\.json$
33+
args:
34+
[
35+
"--schemafile",
36+
"schemas/slicer-extension-catalog-entry-schema-v1.0.0.json",
37+
]
3138
- id: check-dependabot
3239
- id: check-github-workflows
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"$id": "https://raw.githubusercontent.com/Slicer/Slicer/main/Schemas/slicer-extension-catalog-item-schema-v1.0.0.json#",
4+
"type": "object",
5+
"title": "3D Slicer extensions catalog entry schema",
6+
"description": "Schema for storing information about a 3D Slicer extension to allow it to be listed in the extension catalog.",
7+
"required": ["$schema", "category", "scmurl"],
8+
"additionalProperties": true,
9+
"properties": {
10+
"@schema": {
11+
"$id": "#schema",
12+
"type": "string",
13+
"title": "Schema",
14+
"description": "URL of versioned schema."
15+
},
16+
"category": {
17+
"$id": "#category",
18+
"type": "string",
19+
"title": "Category used to organize the extension in the extension catalog."
20+
},
21+
"scmurl": {
22+
"$id": "#scmurl",
23+
"type": "string",
24+
"title": "Filename or URL of the repository."
25+
},
26+
"scmrevision": {
27+
"$id": "#scmrevision",
28+
"type": "string",
29+
"title": "Hash, branch or tag name to identify the revision within the repository."
30+
},
31+
"scm": {
32+
"$id": "#scm",
33+
"type": "string",
34+
"title": "Type of revision control system.",
35+
"enum": ["git", "local"],
36+
"default": "git"
37+
},
38+
"build_dependencies": {
39+
"$id": "#build_dependencies",
40+
"type": "array",
41+
"title": "List of extensions required to build this extension.",
42+
"additionalItems": false,
43+
"items": { "type": "string" }
44+
},
45+
"build_subdirectory": {
46+
"$id": "#build_subdirectory",
47+
"type": "string",
48+
"title": "Name of the inner build directory in case of superbuild based extension.",
49+
"default": "."
50+
},
51+
"enabled": {
52+
"$id": "#enabled",
53+
"type": "boolean",
54+
"title": "Specify if the extension should be enabled after its installation.",
55+
"default": true
56+
}
57+
}
58+
}

scripts/check_filenames.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ unexpected_files=$(find . -mindepth 1 \( -type d \( \
1818
-path ./.github -o \
1919
-path ./.git -o \
2020
-path ./ARCHIVE -o \
21+
-path ./schemas -o \
2122
-path ./scripts \
2223
\) -o -type f \( \
2324
-name .pre-commit-config.yaml -o \

0 commit comments

Comments
 (0)