From a3d4ad597b1336a138726e71c7219615add5f41d Mon Sep 17 00:00:00 2001
From: Felix Blanke <info@fblanke.de>
Date: Tue, 4 Mar 2025 02:36:21 +0100
Subject: [PATCH] Disallow additional properties

---
 schemas/ak.schema.json          |  9 ++++++---
 schemas/participant.schema.json |  9 ++++++---
 schemas/room.schema.json        |  6 ++++--
 schemas/solver-output.json      |  3 ++-
 schemas/timeslot.schema.json    | 10 +++++++---
 5 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/schemas/ak.schema.json b/schemas/ak.schema.json
index f8b6711..bd5bc7a 100644
--- a/schemas/ak.schema.json
+++ b/schemas/ak.schema.json
@@ -33,7 +33,8 @@
           "description": "IDs of all AKs that should be scheduled before this AK"
         }
       },
-      "required": ["conflicts", "dependencies"]
+      "required": ["conflicts", "dependencies"],
+      "additionalProperties": false
     },
     "info": {
       "type": "object",
@@ -43,8 +44,10 @@
         "description": {"description": "Short description of the AK", "type": "string"},
         "reso": {"description": "Whether this AK intends to introduce a resolution", "type": "boolean"}
       },
-      "required": ["name", "head", "description", "reso"]
+      "required": ["name", "head", "description", "reso"],
+      "additionalProperties": false
     }
   },
-  "required": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"]
+  "required": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"],
+  "additionalProperties": false
 }
diff --git a/schemas/participant.schema.json b/schemas/participant.schema.json
index 1a7d665..a7eff8e 100644
--- a/schemas/participant.schema.json
+++ b/schemas/participant.schema.json
@@ -33,7 +33,8 @@
               ]
             }
           },
-          "required": ["ak_id", "required", "preference_score"]
+          "required": ["ak_id", "required", "preference_score"],
+          "additionalProperties": false
         },
         "uniqueItems": true
     },
@@ -48,8 +49,10 @@
     "info": {
       "type": "object",
       "properties": {"name": {"description": "Name of the person", "type": "string"}},
-      "required": ["name"]
+      "required": ["name"],
+      "additionalProperties": false
     }
   },
-  "required": ["id", "room_constraints", "time_constraints", "info"]
+  "required": ["id", "room_constraints", "time_constraints", "info"],
+  "additionalProperties": false
 }
diff --git a/schemas/room.schema.json b/schemas/room.schema.json
index 80b149e..3d921c1 100644
--- a/schemas/room.schema.json
+++ b/schemas/room.schema.json
@@ -26,8 +26,10 @@
       "properties": {
         "name": {"description": "Name of the room", "type": "string"}
       },
-      "required": ["name"]
+      "required": ["name"],
+      "additionalProperties": false
     }
   },
-  "required": ["id", "capacity", "fulfilled_room_constraints", "time_constraints", "info"]
+  "required": ["id", "capacity", "fulfilled_room_constraints", "time_constraints", "info"],
+  "additionalProperties": false
 }
\ No newline at end of file
diff --git a/schemas/solver-output.json b/schemas/solver-output.json
index 20f0917..15ee653 100644
--- a/schemas/solver-output.json
+++ b/schemas/solver-output.json
@@ -41,7 +41,8 @@
             "uniqueItems": true
           }
         },
-        "required": ["ak_id", "room_id", "timeslot_ids", "participant_ids"] 
+        "required": ["ak_id", "room_id", "timeslot_ids", "participant_ids"],
+        "additionalProperties": false
       },
       "uniqueItems": true
     }
diff --git a/schemas/timeslot.schema.json b/schemas/timeslot.schema.json
index a77d8d0..0240c49 100644
--- a/schemas/timeslot.schema.json
+++ b/schemas/timeslot.schema.json
@@ -4,6 +4,7 @@
   "title": "Timeslot",
   "type": "object",
   "required": ["info", "blocks"],
+  "additionalProperties": false,
   "properties": {
     "info": {
       "type": "object",
@@ -19,7 +20,8 @@
           }
         }
       },
-      "required": ["duration"]
+      "required": ["duration"],
+      "additionalProperties": false
     },
     "blocks": {
       "type": "array",
@@ -41,14 +43,16 @@
                 "start": {"description": "Start datetime of the timeslot", "type": "string"},
                 "end": {"description": "End datetime of the timeslot", "type": "string"}
               },
-              "required": ["start", "end"]
+              "required": ["start", "end"],
+              "additionalProperties": false
             },
             "fulfilled_time_constraints": {
               "$ref": "/schema/common/constraints.schema.json",
               "description": "Time constraints fulfilled by this timeslot"
             }
           },
-          "required": ["id", "info", "fulfilled_time_constraints"]
+          "required": ["id", "info", "fulfilled_time_constraints"],
+          "additionalProperties": false
         }
       }
     }
-- 
GitLab