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') +