From 73b1237dddfa2ab3b4824355e010db830de0c060 Mon Sep 17 00:00:00 2001
From: Roy de Goei <goei@astron.nl>
Date: Tue, 26 Apr 2022 10:12:15 +0200
Subject: [PATCH] Update parameters for validatesip command line

---
 bin/validatesip  | 3 ++-
 lib/validator.py | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/validatesip b/bin/validatesip
index 079c597..d12bf5e 100755
--- a/bin/validatesip
+++ b/bin/validatesip
@@ -5,7 +5,8 @@ from lofar.lta.sip.validator import main
 
 def parse_args():
     parser = ArgumentParser(description='validates sip over the xsd')
-    parser.add_argument('sip', help='xml sip to validate')
+    parser.add_argument('--sip', nargs='?', default='', help='xml SIP file to validate')
+    parser.add_argument('--xsd', nargs='?', default=None, help='Alternative xsd schema file for validation')
     return parser.parse_args()
 
 
diff --git a/lib/validator.py b/lib/validator.py
index 98f0acf..16322d3 100644
--- a/lib/validator.py
+++ b/lib/validator.py
@@ -109,14 +109,17 @@ def check_consistency_of_file(xmlpath):
         return check_consistency(sip)
 
 
-def main(xml):
+def main(xml, xsd_file):
     """
     validates given xml against the SIP XSD and does consistency check
     """
 
     try:
         xml = xml
-        xsd = DEFAULT_SIP_XSD_PATH
+        if xsd_file is None:
+            xsd = DEFAULT_SIP_XSD_PATH
+        else:
+            xsd = xsd_file
         valid = validate(xml, xsd)
         consistent = check_consistency_of_file(xml)
         return valid and consistent
-- 
GitLab