Skip to content

Commit 2e8acb9

Browse files
committed
[wip] include option to use json-schema
1 parent c6bff67 commit 2e8acb9

10 files changed

Lines changed: 38 additions & 116 deletions

json_schema/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .geopackage_layers import validate as geopackage
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
4+
"title": "Match Geopackage layers list",
5+
6+
"$comment": "Works for, e.g., ['units','contacts','bla'], but not for ['bla','units','contacts']",
7+
"$example": ["units","contacts","another-column"],
8+
9+
"definitions": {
10+
"layers": {
11+
"type": "string",
12+
"enum": ["units", "contacts"]
13+
}
14+
},
15+
16+
"type": "array",
17+
"items": [
18+
{
19+
"$ref": "#/definitions/layers"
20+
}
21+
],
22+
"minItems": 2,
23+
24+
"uniqueItems": true,
25+
"additionalItems": { "type": "string" }
26+
}
File renamed without changes.

validate.py

100644100755
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
#!/usr/bin/env python
2+
13
import os
24
import check
5+
import json_schema
36

47
if __name__ == '__main__':
58
import argparse
@@ -8,9 +11,16 @@
811
parser.add_argument('gpkg', type=str,
912
help="File/path to Geopackage")
1013

14+
parser.add_argument('--jsonschema', action="store_true",
15+
help="Use json-schema")
16+
17+
1118
args = parser.parse_args()
1219

1320
filename = args.gpkg
1421
assert os.path.isfile(filename), f"Filename '{filename}' does not exist"
1522

16-
check.geopackage(filename)
23+
if args.jsonschema:
24+
json_schema.geopackage(filename)
25+
else:
26+
check.geopackage(filename)

validator/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

validator/validator.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

validator/vector/__init__.py

Whitespace-only changes.

validator/vector/geopackage_layers.schema.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)