diff --git a/AKModel/tests/test_json_export.py b/AKModel/tests/test_json_export.py index 5ec117497b2afd6bdb54cbc1507485303a2df451..71101302890a4351dc78b9241d61b8f29ba537b7 100644 --- a/AKModel/tests/test_json_export.py +++ b/AKModel/tests/test_json_export.py @@ -38,7 +38,7 @@ class JSONExportTest(TestCase): ) cls.json_export_validator = construct_schema_validator( - "solver-input.schema.json" + "solver-input-export.schema.json" ) def setUp(self): diff --git a/schemas/ak-export.schema.json b/schemas/ak-export.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..2ab8cf771645c831ba57ae9bf36d95d0b1882d0c --- /dev/null +++ b/schemas/ak-export.schema.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "schemas/ak-export.schema.json", + "allOf": [{ "$ref": "ak.schema.json" }], + "properties": { + "info": {"unevaluatedProperties": false} + } +} diff --git a/schemas/ak.schema.json b/schemas/ak.schema.json index 24395110fcd3c849cfee0def61edcf61b55e0e55..a8578a347cf78c337f7c99f15942cf268fe1576a 100644 --- a/schemas/ak.schema.json +++ b/schemas/ak.schema.json @@ -53,8 +53,7 @@ "description": "Types of this AK" } }, - "required": ["name", "head", "description", "reso", "duration_in_hours", "django_ak_id", "types"], - "additionalProperties": false + "required": ["name", "head", "description", "reso", "duration_in_hours", "django_ak_id", "types"] } }, "required": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"], diff --git a/schemas/participant-export.schema.json b/schemas/participant-export.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..935b2188ee81872f91a1c53c0dfc139af6bc17c0 --- /dev/null +++ b/schemas/participant-export.schema.json @@ -0,0 +1,20 @@ + +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "schemas/participant-export.schema.json", + "allOf": [{ "$ref": "participant.schema.json" }], + "properties": { + "preferences": { + "items": { + "properties": { + "preference_score": { + "anyOf": [ + {"const": -1}, {"const": 1}, {"const": 2} + ] + } + } + } + }, + "info": {"unevaluatedProperties": false} + } +} diff --git a/schemas/participant.schema.json b/schemas/participant.schema.json index 249944f4f34dbdc0fe00fede6e1431b743f47eb3..70631eb10d3a347e0412fe1ba4adb4c1c7d9035b 100644 --- a/schemas/participant.schema.json +++ b/schemas/participant.schema.json @@ -27,10 +27,7 @@ "description": "The prefeference score for this AK", "default": 0, "minimum": -1, - "maximum": 2, - "anyOf": [ - {"const": -1}, {"const": 1}, {"const": 2} - ] + "maximum": 2 } }, "required": ["ak_id", "required", "preference_score"], @@ -49,8 +46,7 @@ "info": { "type": "object", "properties": {"name": {"description": "Name of the person", "type": "string"}}, - "required": ["name"], - "additionalProperties": false + "required": ["name"] } }, "required": ["id", "room_constraints", "time_constraints", "info"], diff --git a/schemas/room-export.schema.json b/schemas/room-export.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..bc14670a236e461861e656d06bc638ba3f0e034e --- /dev/null +++ b/schemas/room-export.schema.json @@ -0,0 +1,8 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "schemas/room-export.schema.json", + "allOf": [{ "$ref": "room.schema.json" }], + "properties": { + "info": {"unevaluatedProperties": false} + } +} diff --git a/schemas/room.schema.json b/schemas/room.schema.json index f77d8fdbd1ae4ae490819bc70e182bdd25f2e0e8..dbf331f124f6e96fc05c2c533ed34a30105417fb 100644 --- a/schemas/room.schema.json +++ b/schemas/room.schema.json @@ -28,8 +28,7 @@ "properties": { "name": {"description": "Name of the room", "type": "string"} }, - "required": ["name"], - "additionalProperties": false + "required": ["name"] } }, "required": ["id", "capacity", "fulfilled_room_constraints", "time_constraints", "info"], diff --git a/schemas/solver-input-export.schema.json b/schemas/solver-input-export.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..e870d6886456ffd62895c48b185d3ffe210a6b29 --- /dev/null +++ b/schemas/solver-input-export.schema.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "schemas/solver-input-export.schema.json", + "allOf": [{ "$ref": "solver-input.schema.json"}], + "properties": { + "participants": {"items": {"$ref": "participant-export.schema.json"}}, + "rooms": {"items": {"$ref": "room-export.schema.json"}}, + "timeslots": {"items": {"$ref": "timeslot-export.schema.json"}}, + "aks": {"items": {"$ref": "ak-export.schema.json"}}, + "info": {"unevaluatedProperties": false} + } +} \ No newline at end of file diff --git a/schemas/solver-input.schema.json b/schemas/solver-input.schema.json index 95952d706a43113f54c53c7aa6004c8bd27bbea4..faece29b0b2bbf402798646d2d112e74a778e9ca 100644 --- a/schemas/solver-input.schema.json +++ b/schemas/solver-input.schema.json @@ -14,8 +14,7 @@ "slug": {"type": "string"}, "place": {"type": "string"}, "contact_email": {"type": "string"} - }, - "additionalProperties": false + } } }, "required": ["aks", "rooms", "participants", "timeslots", "info"], diff --git a/schemas/timeslot-export.schema.json b/schemas/timeslot-export.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..d0bef1249746910ca0638b90c8face56cc4656b2 --- /dev/null +++ b/schemas/timeslot-export.schema.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "schemas/timeslot-export.schema.json", + "allOf": [{ "$ref": "timeslot.schema.json" }], + "properties": { + "info": {"unevaluatedProperties": false}, + "blocks": { + "items": { + "items": { + "info": {"unevaluatedProperties": false} + } + } + } + } +} diff --git a/schemas/timeslot.schema.json b/schemas/timeslot.schema.json index e6d5b828a8bb12eb4cd18c829cccdd87f650c99d..2cd23cd0fc877c2d4ce05b11a87b797f9299083c 100644 --- a/schemas/timeslot.schema.json +++ b/schemas/timeslot.schema.json @@ -20,8 +20,7 @@ } } }, - "required": ["duration"], - "additionalProperties": false + "required": ["duration"] }, "blocks": { "type": "array", @@ -43,8 +42,7 @@ "start": {"description": "Start datetime of the timeslot", "type": "string"}, "end": {"description": "End datetime of the timeslot", "type": "string"} }, - "required": ["start", "end"], - "additionalProperties": false + "required": ["start", "end"] }, "fulfilled_time_constraints": { "$ref": "common/constraints.schema.json",