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

Add initial json schemas

parent abe8fc86
No related branches found
No related tags found
1 merge request!25Feature: Use JSON schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/ak.schema.json",
"title": "AK",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier of a room",
"type": "integer",
"minimum": 0
},
"duration": {
"description": "The number of consecutive slot units",
"type": "integer",
"exclusiveMinimum": 0
},
"room_constraints": {
"description": "Room constraints required by this AK",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"time_constraints": {
"description": "Time constraints required by this AK",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"properties": {
"type": "object",
"properties": {
"conflicts": {
"description": "IDs of all AKs that are in conflict with this AK",
"type": "array",
"items": {"type": "integer"},
"uniqueItems": true
},
"dependencies": {
"description": "IDs of all AKs that should be scheduled before this AK",
"type": "array",
"items": {"type": "integer"},
"uniqueItems": true
}
},
"required": ["conflicts", "dependencies"]
},
"info": {
"type": "object",
"properties": {
"name": {"description": "Name of the AK", "type": "string"},
"head": {"description": "Name of the head of the AK", "type": "string"},
"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": ["id", "duration", "room_constraints", "time_constraints", "properties", "info"]
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/participant.schema.json",
"title": "Participant",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier of a participant",
"type": "integer",
"minimum": 0
},
"preferences": {
"description": "AK preferences of the participant",
"type": "array",
"items": {
"type": "object",
"properties": {
"ak_id": {
"type": "integer",
"description": "The unique identifier of the AK",
"minimum": 0
},
"required": {
"type": "boolean",
"description": "whether this participant is required for the AK"
},
"preference_score": {
"type": "integer",
"description": "The prefeference score for this AK",
"default": 0,
"minimum": -1,
"maximum": 2,
"anyOf": [
{"const": -1}, {"const": 1}, {"const": 2}
]
}
},
"required": ["ak_id", "required", "preference_score"]
},
"uniqueItems": true
},
"room_constraints": {
"description": "Room constraints required by this participant",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"time_constraints": {
"description": "Time constraints required by this participant",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"info": {
"type": "object",
"properties": {"name": {"description": "Name of the person", "type": "string"}},
"required": ["name"]
}
},
"required": ["id", "room_constraints", "time_constraints", "info"]
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/room.schema.json",
"title": "Room",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier of a room",
"type": "integer",
"minimum": 0
},
"capacity": {
"description": "The maximum number of total participants. Unbounded capacity is represented by -1",
"type": "integer",
"minimum": -1
},
"fulfilled_room_constraints": {
"description": "Constraints fulfilled by this room",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"time_constraints": {
"description": "Time constraints required by this room",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
},
"info": {
"type": "object",
"properties": {
"name": {
"description": "Name of the room",
"type": "string"
}
},
"required": ["name"]
}
},
"required": ["id", "capacity", "fulfilled_room_constraints", "time_constraints", "info"]
}
\ No newline at end of file
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/solver-input.schema.json",
"type": "object",
"properties": {
"aks": {"$ref": "schema/ak.schema.json"},
"rooms": {"$ref": "schema/room.schema.json"},
"participants": {"$ref": "schema/participant.schema.json"},
"timeslots": {"$ref": "schema/timeslot.schema.json"},
"info": {
"type": "object",
"properties": {
"title": {"type": "string"},
"slug": {"type": "string"},
"place": {"type": "string"},
"contact_email": {"type": "string"}
}
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/solver-output.schema.json",
"type": "object",
"properties": {
"input": {"$ref": "schema/solver-input.schema.json"},
"scheduled_aks": {
"type": "array",
"items": {
"description": "An object representing the scheduling information for one AK",
"type": "object",
"properties": {
"ak_id": {
"description": "The unique identifier of the scheduled AK",
"type": "integer",
"minimum": 0
},
"room_id": {
"description": "The unique identifier of the room the AK takes place in",
"type": "integer",
"minimum": 0
},
"timeslot_ids": {
"description": "The unique identifiers of all timeslots the AK takes place in",
"type": "array",
"items": {
"description": "The unique identifier of the referenced timeslot",
"type": "integer",
"minimum": 0
},
"uniqueItems": true
},
"participant_ids": {
"description": "The unique identifiers of all participants assigned to the AK",
"type": "array",
"items": {
"description": "The unique identifier of the referenced participant",
"type": "integer",
"minimum": 0
},
"uniqueItems": true
}
},
"required": ["ak_id", "room_id", "timeslot_ids", "participant_ids"]
},
"uniqueItems": true
}
}
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/schema/timeslot.schema.json",
"title": "Timeslot",
"type": "object",
"required": ["info", "blocks"],
"properties": {
"info": {
"type": "object",
"properties": {
"duration": {"description": "Duration in hours of a slot unit", "type": "number"},
"blocknames": {
"type": "array",
"items": {
"type": "array",
"items": {"type": "string"},
"minItems": 2,
"maxItems": 2
}
}
},
"required": ["duration"]
},
"blocks": {
"type": "array",
"description": "Blocks of consecutive timeslots",
"items": {
"type": "array",
"description": "A single block of consecutive timeslots",
"items": {
"type": "object",
"description": "A single timeslot",
"properties": {
"id": {
"description": "The unique identifier of the single timeslot. Accross all blocks, the ids must be sorted chronologically.",
"type": "integer",
"minimum": 0
},
"info": {
"type": "object",
"properties": {
"start": {"description": "Start datetime of the timeslot", "type": "string"},
"end": {"description": "End datetime of the timeslot", "type": "string"}
},
"required": ["start", "end"]
},
"fulfilled_time_constraints": {
"description": "Time constraints fulfilled by this timeslot",
"type": "array",
"items": {"type": "string"},
"uniqueItems": true
}
},
"required": ["id", "info", "fulfilled_time_constraints"]
}
}
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment