Skip to content

Commit bbe1aec

Browse files
committed
Test json files with jsonschema
1 parent 625276f commit bbe1aec

File tree

6 files changed

+299
-70
lines changed

6 files changed

+299
-70
lines changed

Diff for: schemas/journals.json

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"patternProperties": {
5+
"^.*$": {
6+
"type": "array",
7+
"items": [
8+
{
9+
"type": "object",
10+
"properties": {
11+
"cite_type": {
12+
"type": "string"
13+
},
14+
"end": {
15+
"type": [
16+
"string",
17+
"null"
18+
]
19+
},
20+
"examples": {
21+
"type": "array",
22+
"items": {
23+
"type": "string"
24+
}
25+
},
26+
"name": {
27+
"type": "string"
28+
},
29+
"notes": {
30+
"type": "string"
31+
},
32+
"regexes": {
33+
"type": "array",
34+
"items": {
35+
"type": "string"
36+
}
37+
},
38+
"start": {
39+
"type": [
40+
"string",
41+
"null"
42+
]
43+
},
44+
"variations": {
45+
"type": "array",
46+
"items": {
47+
"type": "string"
48+
}
49+
}
50+
},
51+
"required": [
52+
"cite_type",
53+
"end",
54+
"examples",
55+
"name",
56+
"regexes",
57+
"start",
58+
"variations"
59+
],
60+
"additionalProperties": false
61+
}
62+
]
63+
}
64+
},
65+
"additionalProperties": false
66+
}

Diff for: schemas/laws.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"patternProperties": {
5+
"^.*$": {
6+
"type": "array",
7+
"items": [
8+
{
9+
"type": "object",
10+
"properties": {
11+
"cite_type": {
12+
"type": "string"
13+
},
14+
"end": {
15+
"type": ["string", "null"]
16+
},
17+
"examples": {
18+
"type": "array",
19+
"items": {
20+
"type": "string"
21+
}
22+
},
23+
"href": {
24+
"type": "string"
25+
},
26+
"jurisdiction": {
27+
"type": "string"
28+
},
29+
"name": {
30+
"type": "string"
31+
},
32+
"notes": {
33+
"type": "string"
34+
},
35+
"regexes": {
36+
"type": "array",
37+
"items": {
38+
"type": "string"
39+
}
40+
},
41+
"start": {
42+
"type": ["string", "null"]
43+
},
44+
"variations": {
45+
"type": "array",
46+
"items": {
47+
"type": "string"
48+
}
49+
}
50+
},
51+
"required": [
52+
"cite_type",
53+
"end",
54+
"examples",
55+
"jurisdiction",
56+
"name",
57+
"regexes",
58+
"start",
59+
"variations"
60+
],
61+
"additionalProperties": false
62+
}
63+
]
64+
}
65+
},
66+
"additionalProperties": false
67+
}

Diff for: schemas/regexes.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"definitions": {
4+
"regexes": {
5+
"type": "object",
6+
"patternProperties": {
7+
"^[a-z0-9_]*#?$": {
8+
"anyOf": [
9+
{
10+
"$ref": "#/definitions/regexes"
11+
},
12+
{
13+
"type": "string"
14+
}
15+
]
16+
}
17+
},
18+
"additionalProperties": false
19+
}
20+
},
21+
"$ref": "#/definitions/regexes"
22+
}

Diff for: schemas/reporters.json

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"patternProperties": {
5+
"^.*$": {
6+
"type": "array",
7+
"items": [
8+
{
9+
"type": "object",
10+
"properties": {
11+
"cite_type": {
12+
"type": "string"
13+
},
14+
"cite_format": {
15+
"type": "string"
16+
},
17+
"editions": {
18+
"type": "object",
19+
"patternProperties": {
20+
"^.*$": {
21+
"type": "object",
22+
"properties": {
23+
"end": {
24+
"type": [
25+
"string",
26+
"null"
27+
]
28+
},
29+
"regexes": {
30+
"type": "array",
31+
"items": {
32+
"type": [
33+
"string",
34+
"null"
35+
]
36+
}
37+
},
38+
"start": {
39+
"type": [
40+
"string",
41+
"null"
42+
]
43+
}
44+
},
45+
"required": [
46+
"end",
47+
"start"
48+
]
49+
}
50+
},
51+
"additionalProperties": false
52+
},
53+
"examples": {
54+
"type": "array",
55+
"items": {
56+
"type": "string"
57+
}
58+
},
59+
"href": {
60+
"type": "string"
61+
},
62+
"mlz_jurisdiction": {
63+
"type": "array",
64+
"items": {
65+
"type": "string"
66+
}
67+
},
68+
"name": {
69+
"type": "string"
70+
},
71+
"notes": {
72+
"type": "string"
73+
},
74+
"publisher": {
75+
"type": "string"
76+
},
77+
"variations": {
78+
"type": "object",
79+
"patternProperties": {
80+
"^.*$": {
81+
"type": "string"
82+
}
83+
},
84+
"additionalProperties": false
85+
}
86+
},
87+
"required": [
88+
"cite_type",
89+
"editions",
90+
"mlz_jurisdiction",
91+
"name",
92+
"variations"
93+
],
94+
"additionalProperties": false
95+
}
96+
]
97+
}
98+
},
99+
"additionalProperties": false
100+
}

Diff for: setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ def read(*parts):
5454
"Topic :: Software Development :: Libraries :: Python Modules",
5555
],
5656
install_requires=reqs,
57+
tests_require=["jsonschema==3.2.0"],
5758
test_suite="tests",
5859
)

0 commit comments

Comments
 (0)