Skip to content
Snippets Groups Projects
Commit 90216286 authored by Felix Blanke's avatar Felix Blanke
Browse files

Split schema into general and export schema

parent 89290017
No related branches found
No related tags found
1 merge request!25Feature: Use JSON schema
...@@ -38,7 +38,7 @@ class JSONExportTest(TestCase): ...@@ -38,7 +38,7 @@ class JSONExportTest(TestCase):
) )
cls.json_export_validator = construct_schema_validator( cls.json_export_validator = construct_schema_validator(
"solver-input.schema.json" "solver-input-export.schema.json"
) )
def setUp(self): def setUp(self):
......
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schemas/ak-export.schema.json",
"allOf": [{ "$ref": "ak.schema.json" }],
"properties": {
"info": {"unevaluatedProperties": false}
}
}
...@@ -53,8 +53,7 @@ ...@@ -53,8 +53,7 @@
"description": "Types of this AK" "description": "Types of this AK"
} }
}, },
"required": ["name", "head", "description", "reso", "duration_in_hours", "django_ak_id", "types"], "required": ["name", "head", "description", "reso", "duration_in_hours", "django_ak_id", "types"]
"additionalProperties": false
} }
}, },
"required": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"], "required": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"],
......
{
"$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}
}
}
...@@ -27,10 +27,7 @@ ...@@ -27,10 +27,7 @@
"description": "The prefeference score for this AK", "description": "The prefeference score for this AK",
"default": 0, "default": 0,
"minimum": -1, "minimum": -1,
"maximum": 2, "maximum": 2
"anyOf": [
{"const": -1}, {"const": 1}, {"const": 2}
]
} }
}, },
"required": ["ak_id", "required", "preference_score"], "required": ["ak_id", "required", "preference_score"],
...@@ -49,8 +46,7 @@ ...@@ -49,8 +46,7 @@
"info": { "info": {
"type": "object", "type": "object",
"properties": {"name": {"description": "Name of the person", "type": "string"}}, "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"],
......
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schemas/room-export.schema.json",
"allOf": [{ "$ref": "room.schema.json" }],
"properties": {
"info": {"unevaluatedProperties": false}
}
}
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
"properties": { "properties": {
"name": {"description": "Name of the room", "type": "string"} "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"],
......
{
"$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
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
"slug": {"type": "string"}, "slug": {"type": "string"},
"place": {"type": "string"}, "place": {"type": "string"},
"contact_email": {"type": "string"} "contact_email": {"type": "string"}
}, }
"additionalProperties": false
} }
}, },
"required": ["aks", "rooms", "participants", "timeslots", "info"], "required": ["aks", "rooms", "participants", "timeslots", "info"],
......
{
"$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}
}
}
}
}
}
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
} }
} }
}, },
"required": ["duration"], "required": ["duration"]
"additionalProperties": false
}, },
"blocks": { "blocks": {
"type": "array", "type": "array",
...@@ -43,8 +42,7 @@ ...@@ -43,8 +42,7 @@
"start": {"description": "Start datetime of the timeslot", "type": "string"}, "start": {"description": "Start datetime of the timeslot", "type": "string"},
"end": {"description": "End 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": { "fulfilled_time_constraints": {
"$ref": "common/constraints.schema.json", "$ref": "common/constraints.schema.json",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment