Commit 0ffa828 1 parent c6ed595 commit 0ffa828 Copy full SHA for 0ffa828
File tree 3 files changed +34
-1
lines changed
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ language : python
2
+ python :
3
+ - 3.4
4
+ install :
5
+ - make setup
6
+ script :
7
+ - make validate
8
+ notifications :
9
+ email : false
Original file line number Diff line number Diff line change 2
2
pip install --quiet -r scripts/requirements-test.txt
3
3
4
4
validate : setup # # Validate data
5
- python scripts/jsonvalidate .py
5
+ python scripts/validate_yaml .py
6
6
7
7
json : setup # # Generate JSON from YAML
8
8
python scripts/yaml2json.py < data/committees.yml > outputs/committees.json
Original file line number Diff line number Diff line change
1
+ from jsonschema import validate
2
+ import jsonschema
3
+ import json
4
+ import yaml
5
+ import os
6
+
7
+ schema_relpath = 'scripts/jsonschema/schemas/popolo/organization.json'
8
+ schema_abspath = 'file://' + os .path .abspath (schema_relpath )
9
+
10
+ org_schema = json .load (open (schema_relpath , 'r' ))
11
+
12
+ organizations = yaml .load (open ('data/committees.yml' , 'r' ))
13
+
14
+ class patchedResolver (jsonschema .RefResolver ):
15
+ def __init__ (self ):
16
+ jsonschema .RefResolver .__init__ (self ,
17
+ base_uri = schema_abspath ,
18
+ referrer = None )
19
+ self .store [schema_abspath ] = org_schema
20
+
21
+ newResolver = patchedResolver ()
22
+
23
+ for org in organizations :
24
+ validate (org , org_schema , resolver = newResolver )
You can’t perform that action at this time.
0 commit comments