From e8d81c128f4d13bdd3f3a838ab88bed1ada2db22 Mon Sep 17 00:00:00 2001 From: Alisha <43160608+alishahusain@users.noreply.github.com> Date: Fri, 11 Sep 2020 19:19:18 -0700 Subject: [PATCH] Added lines under __main__ for user command line input --- Validate_JsonFile_Schema.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Validate_JsonFile_Schema.py b/Validate_JsonFile_Schema.py index 17206c2..c2560fe 100644 --- a/Validate_JsonFile_Schema.py +++ b/Validate_JsonFile_Schema.py @@ -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': @@ -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') +