Skip to content

Commit a2a2a2f

Browse files
committed
Add a initial library shcema
1 parent 5f0d03e commit a2a2a2f

File tree

2 files changed

+150
-2
lines changed

2 files changed

+150
-2
lines changed

arho-feature-template.code-workspace

+16-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,29 @@
1717
"python.testing.pytestArgs": [
1818
"test"
1919
],
20-
"python.testing.unittestEnabled": false
20+
"python.testing.unittestEnabled": false,
21+
"json.schemas": [
22+
{
23+
"fileMatch": [
24+
"**/template_libraries/*.json"
25+
],
26+
"url": "./arho_feature_template/resources/template_libraries/schema/template_library.schema.json"
27+
}
28+
],
29+
"yaml.schemas": {
30+
"./arho_feature_template/resources/template_libraries/schema/template_library.schema.json": [
31+
"**/template_libraries/*.yaml"
32+
]
33+
}
2134
},
2235
"extensions": {
2336
"recommendations": [
2437
"ms-python.python",
2538
"ms-python.flake8",
2639
"ms-python.mypy-type-checker",
2740
"charliermarsh.ruff",
28-
"editorconfig.editorconfig"
41+
"editorconfig.editorconfig",
42+
"redhat.vscode-yaml"
2943
]
3044
},
3145
"launch": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://gispocoding.com/featuretemplate/template_library.schema.json",
4+
"title": "Feature Template Library",
5+
"description": "Configuration file for QGIS feature templates",
6+
"type": "object",
7+
"required": [
8+
"version",
9+
"meta",
10+
"templates"
11+
],
12+
"additionalProperties": false,
13+
"properties": {
14+
"version": {
15+
"description": "The version of the template library syntax used in the file",
16+
"type": "integer"
17+
},
18+
"meta": {
19+
"$ref": "#/$defs/template_library_meta"
20+
},
21+
"templates": {
22+
"description": "The list of templates in the library",
23+
"type": "array",
24+
"items": {
25+
"$ref": "#/$defs/template"
26+
}
27+
}
28+
},
29+
"$defs": {
30+
"attribute": {
31+
"type": "object",
32+
"additionalProperties": false,
33+
"properties": {
34+
"attribute": {
35+
"description": "The name of the attribute",
36+
"type": "string"
37+
},
38+
"default": {
39+
"description": "The default value of the attribute",
40+
"type": [
41+
"number",
42+
"string"
43+
]
44+
},
45+
"hidden": {
46+
"description": "Is the attribute hidden from the user",
47+
"type": "boolean"
48+
},
49+
"allow_user_input": {
50+
"description": "Is the user allowed to input the value",
51+
"type": "boolean"
52+
}
53+
},
54+
"required": [
55+
"attribute"
56+
]
57+
},
58+
"feature": {
59+
"type": "object",
60+
"required": [
61+
"layer"
62+
],
63+
"additionalProperties": false,
64+
"properties": {
65+
"layer": {
66+
"description": "The name of the layer in which the feature is to be inserted",
67+
"type": "string"
68+
},
69+
"attributes": {
70+
"description": "List of attributes to be written for the feature",
71+
"type": "array",
72+
"items": {
73+
"$ref": "#/$defs/attribute"
74+
}
75+
},
76+
"child_features": {
77+
"description": "List of related features to be created",
78+
"type": "array",
79+
"items": {
80+
"$ref": "#/$defs/feature"
81+
}
82+
}
83+
}
84+
},
85+
"template": {
86+
"type": "object",
87+
"additionalProperties": false,
88+
"properties": {
89+
"name": {
90+
"description": "The name of the template",
91+
"type": "string"
92+
},
93+
"description": {
94+
"description": "The description of the template",
95+
"type": "string"
96+
},
97+
"icon": {
98+
"description": "The icon path of the template",
99+
"type": "string"
100+
},
101+
"feature": {
102+
"description": "The root feature of the template",
103+
"$ref": "#/$defs/feature"
104+
}
105+
}
106+
},
107+
"template_library_meta": {
108+
"description": "Metadata of the template library",
109+
"type": "object",
110+
"properties": {
111+
"name": {
112+
"description": "The name of the template library",
113+
"type": "string"
114+
},
115+
"description": {
116+
"description": "The description of the template library",
117+
"type": "string"
118+
},
119+
"version": {
120+
"description": "The version of the template library",
121+
"type": "string"
122+
},
123+
"author": {
124+
"description": "The author of the template library",
125+
"type": "string"
126+
}
127+
},
128+
"required": [
129+
"name",
130+
"version"
131+
]
132+
}
133+
}
134+
}

0 commit comments

Comments
 (0)