Skip to content

Commit 60308fd

Browse files
committed
Split schemas into individual files
1 parent 1942692 commit 60308fd

File tree

5 files changed

+296
-282
lines changed

5 files changed

+296
-282
lines changed

assigner/config/schemas.py

-282
This file was deleted.

assigner/config/schemas/__init__.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from . import v0
2+
from . import v1
3+
from . import v2
4+
5+
SCHEMAS = [
6+
v0.V0,
7+
v1.V1,
8+
v2.V2,
9+
]

assigner/config/schemas/v0.py

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Version 0
2+
# Initial config version!
3+
4+
V0 = {
5+
"$schema": "http://json-schema.org/schema#",
6+
7+
"type": "object",
8+
"properties": {
9+
# GitLab private token
10+
"token": {
11+
"type": "string",
12+
},
13+
14+
# GitLab domain (https://git.gitlab.com)
15+
"gitlab-host": {
16+
"type": "string",
17+
},
18+
19+
# GitLab Namespace name
20+
"namespace": {
21+
"type": "string",
22+
},
23+
24+
# GitLab Namespace ID (we'd have to retrieve that)
25+
"namespace-id": {
26+
"type": "integer",
27+
},
28+
29+
# Verbose name of the course (might be unnecessary)
30+
"course-name": {
31+
"type": "string",
32+
},
33+
34+
# Current semester
35+
"semester": {
36+
"type": "string",
37+
"pattern": r"^\d{4}-(SP|FS|SS)$"
38+
},
39+
40+
# Roster of students
41+
"roster": {
42+
"type": "array",
43+
"items": {
44+
"type": "object",
45+
"properties": {
46+
47+
# Their full name
48+
"name": {
49+
"type": "string"
50+
},
51+
52+
# Section
53+
"section": {
54+
"type": "string"
55+
},
56+
57+
# Their GitLab username (single sign on)
58+
"username": {
59+
"type": "string",
60+
"pattern": "^[\w\.\-]+$",
61+
},
62+
63+
# Their GitLab id (might be handy, but we'd have
64+
# to fetch it and save it). Should save time in
65+
# the long run instead of constantly querying
66+
"id": {
67+
"type": "integer",
68+
},
69+
},
70+
"required": ["name", "username", "section"],
71+
"additionalProperties": False,
72+
},
73+
},
74+
75+
# Canvas API token
76+
"canvas-token": {
77+
"type": "string",
78+
},
79+
# Canvas domain
80+
"canvas-host": {
81+
"type": "string",
82+
}
83+
},
84+
"required": ["gitlab-host", "namespace", "token", "semester"],
85+
"additionalProperties": False,
86+
}

0 commit comments

Comments
 (0)