-
Notifications
You must be signed in to change notification settings - Fork 77
/
azure-pipelines.yml
53 lines (44 loc) · 1.35 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
trigger:
- master
pr:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
architecture: 'x64'
- task: PythonScript@0
displayName: 'Test fhir-ig-list.json is valid json.'
inputs:
scriptSource: 'inline'
script: |
import json
f = open("fhir-ig-list.json","r")
file_contents = f.read()
print(file_contents)
json_object = json.loads(file_contents)
- task: PythonScript@0
displayName: 'Test all fhir-version fields are lists.'
inputs:
scriptSource: 'inline'
script: |
import json
def item_generator(json_input, lookup_key):
if isinstance(json_input, dict):
for k, v in json_input.items():
if k == lookup_key:
yield v
else:
yield from item_generator(v, lookup_key)
elif isinstance(json_input, list):
for item in json_input:
yield from item_generator(item, lookup_key)
json_file = open("fhir-ig-list.json", "r")
file_contents = json_file.read()
jdata = json.loads(file_contents)
for _ in item_generator(jdata, "fhir-version"):
if type(_) != list:
raise Exception("one of the fhir-version fields has a non-list value, please fix this")