diff utilities/vampipe-convert.cpp @ 67:db17657ac875

Validation fixes
author Chris Cannam <c.cannam@qmul.ac.uk>
date Wed, 05 Oct 2016 13:53:08 +0100
parents 6f160dee1192
children a5ba837bca28
line wrap: on
line diff
--- a/utilities/vampipe-convert.cpp	Tue Sep 27 15:04:59 2016 +0100
+++ b/utilities/vampipe-convert.cpp	Wed Oct 05 13:53:08 2016 +0100
@@ -46,10 +46,10 @@
     }
     if (!j.is_object()) {
 	err = "object expected at top level";
-    } else if (!j["type"].is_string()) {
-	err = "string expected for type field";
-    } else if (!j["content"].is_null() && !j["content"].is_object()) {
-	err = "object expected for content field";
+    } else if (!j["method"].is_string()) {
+	err = "string expected for method field";
+    } else if (!j["params"].is_null() && !j["params"].is_object()) {
+	err = "object expected for params field";
     }
     return j;
 }
@@ -64,10 +64,12 @@
     }
     if (!j.is_object()) {
 	err = "object expected at top level";
-    } else if (!j["success"].is_bool()) {
-	err = "bool expected for success field";
-    } else if (!j["content"].is_object()) {
-	err = "object expected for content field";
+    } else {
+        if (!j["result"].is_object()) {
+            if (!j["error"].is_object()) {
+                err = "expected either result or error object";
+            }
+        }
     }
     return j;
 }