change version to be aligned with OSM version
[osm/NBI.git] / osm_nbi / validation.py
index a081ffa..904abbd 100644 (file)
@@ -661,20 +661,34 @@ roles_new_schema = {
     "type": "object",
     "properties": {
         "name": shortname_schema,
-        "root": bool_schema,
+        "permissions": {
+            "type": "object",
+            "patternProperties": {
+                ".": bool_schema,
+            },
+            # "minProperties": 1,
+        }
     },
-    "required": ["name", "root"],
-    "additionalProperties": True
+    "required": ["name"],
+    "additionalProperties": False
 }
 roles_edit_schema = {
     "$schema": "http://json-schema.org/draft-04/schema#",
     "title": "Roles edit schema for administrators",
     "type": "object",
     "properties": {
-        "root": bool_schema,
+        "name": shortname_schema,
+        "permissions": {
+            "type": "object",
+            "patternProperties": {
+                ".": {
+                    "oneOf": [bool_schema, null_schema]
+                }
+            },
+            # "minProperties": 1,
+        }
     },
-    "required": ["root"],
-    "additionalProperties": True,
+    "additionalProperties": False,
     "minProperties": 1
 }
 
@@ -793,5 +807,5 @@ def is_valid_uuid(x):
     try:
         if UUID(x):
             return True
-    except (TypeError, ValueError):
+    except (TypeError, ValueError, AttributeError):
         return False