Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Validate_JsonFile_Schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import ntpath
import argparse

def minItems_error(errors,index):
if len(errors.schema_path)==8 and errors.schema_path[7]=='minItems' and errors.schema_path[4]=='geometry':
Expand Down Expand Up @@ -68,3 +69,18 @@ def validate_json_schema(geojson_path=None, schema_path=None, writePath=None):

if __name__ == '__main__':
cf = DefaultConfigs()
parser = argparse.ArgumentParser(description='Run Pipeline')
parser.add_argument('--jsonInputPath', help="geo_json path input", required=True)
parser.add_argument('--schemaInputPath', help="schema path input", required=True)
parser.add_argument('--writePath', help="output path", required=True)
args = parser.parse_args()
result = validate_json_schema(args.jsonInputPath, args.schemaInputPath)
asjson = json.dumps(result)
if json.loads(asjson):
print('Generated validation')
valid_file = open(args.writePath, "w")
valid_file.write(asjson)
valid_file.close()
else:
print('error generating validation')