lewtun HF staff commited on
Commit
b6fc16d
1 Parent(s): 6d09ca9

Make keys required field, add schema generator

Browse files
Files changed (3) hide show
  1. requirements-dev.txt +2 -0
  2. schema.json +3 -6
  3. schema.py +27 -0
requirements-dev.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -r requirements.txt
2
+ pydantic
schema.json CHANGED
@@ -13,7 +13,7 @@
13
  },
14
  "description": {
15
  "title": "Description",
16
- "default": "An optional brief description of the system that will be shown on the website",
17
  "type": "string"
18
  },
19
  "tasks": {
@@ -43,10 +43,6 @@
43
  },
44
  "keys": {
45
  "title": "Keys",
46
- "default": [
47
- "schema_guided_dialog-test-9585",
48
- "schema_guided_dialog-test-9585"
49
- ],
50
  "type": "array",
51
  "items": {
52
  "type": "string"
@@ -54,7 +50,8 @@
54
  }
55
  },
56
  "required": [
57
- "values"
 
58
  ]
59
  }
60
  }
 
13
  },
14
  "description": {
15
  "title": "Description",
16
+ "default": "An optional brief description of the system that will be shown on the results page",
17
  "type": "string"
18
  },
19
  "tasks": {
 
43
  },
44
  "keys": {
45
  "title": "Keys",
 
 
 
 
46
  "type": "array",
47
  "items": {
48
  "type": "string"
 
50
  }
51
  },
52
  "required": [
53
+ "values",
54
+ "keys"
55
  ]
56
  }
57
  }
schema.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Dict, List
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class Task(BaseModel):
7
+ values: List[str]
8
+ keys: List[str]
9
+
10
+
11
+ class GEMSchema(BaseModel):
12
+ """The default GEM schema"""
13
+
14
+ submission_name: str
15
+ param_count: int
16
+ description: str = "An optional brief description of the system that will be shown on the results page"
17
+ tasks: Dict[str, Task]
18
+
19
+
20
+ def main():
21
+ schema_data = GEMSchema.schema_json(indent=2)
22
+ with open("schema.json", "w", encoding="utf-8") as f:
23
+ f.write(schema_data)
24
+
25
+
26
+ if __name__ == "__main__":
27
+ main()