Skip to content

Commit 25022fc

Browse files
authored
Fix examples + fix filters schema + proper file validation error message (#107)
* Improve terrain example * Improve error message upon file validation failure * Linter * Fix filters schema
1 parent 901515e commit 25022fc

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

examples/3d_terrain.jGIS

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"source": "1f457f60-5d31-45f6-8066-4585aabd5629"
1212
},
1313
"type": "HillshadeLayer",
14-
"visible": false
14+
"visible": true
1515
},
1616
"a82ef521-e727-4209-a5a0-145d66f18a06": {
1717
"name": "OpenStreetMap.Mapnik Layer",
@@ -24,10 +24,10 @@
2424
},
2525
"options": {
2626
"bearing": 0.0,
27-
"latitude": 47.574246213179435,
28-
"longitude": 11.723541623071242,
29-
"pitch": 0.0,
30-
"zoom": 9.941497348883567
27+
"latitude": 47.27340570466396,
28+
"longitude": 11.540279388427734,
29+
"pitch": 59.00000000000003,
30+
"zoom": 11.829283007646955
3131
},
3232
"sources": {
3333
"1f457f60-5d31-45f6-8066-4585aabd5629": {
@@ -60,5 +60,9 @@
6060
},
6161
"type": "RasterDemSource"
6262
}
63+
},
64+
"terrain": {
65+
"exaggeration": 1.0,
66+
"source": "1f457f60-5d31-45f6-8066-4585aabd5629"
6367
}
6468
}

packages/schema/src/model.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ export class JupyterGISModel implements IJupyterGISModel {
167167
const valid = validate(jsonData);
168168

169169
if (!valid) {
170-
throw Error('File format error');
170+
let errorMsg = 'File format errors:\n';
171+
for (const error of validate.errors || []) {
172+
errorMsg = `${errorMsg}- ${error.instancePath} ${error.message}\n`;
173+
}
174+
throw Error(errorMsg);
171175
}
172176

173177
this.sharedModel.transact(() => {

packages/schema/src/schema/jgis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
"title": "IJGISFilterItem",
189189
"type": "object",
190190
"default": {},
191-
"required": ["layerId", "operator", "feature", "value"],
191+
"required": ["operator", "feature", "value"],
192192
"additionalProperties": false,
193193
"properties": {
194194
"operator": {

0 commit comments

Comments
 (0)