Skip to content

Commit cf31049

Browse files
authored
Merge pull request #12 from jmespath/validate
Add JSON schema validation
2 parents 88a0cb3 + a0d33f4 commit cf31049

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
language: python
2+
python:
3+
- "3.5"
4+
install: "pip install jsonschema==2.5.1"
5+
script: ls tests/*.json | xargs -I {} jsonschema schema.json -i {}

schema.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"type": "array",
3+
"items": {
4+
"type": "object",
5+
"additionalProperties": "false",
6+
"properties": {
7+
"given": {},
8+
"comment": {"type": "string"},
9+
"cases": {
10+
"type": "array",
11+
"items": {
12+
"type": "object",
13+
"additionalProperties": false,
14+
"properties": {
15+
"expression": {"type": "string"},
16+
"result": {},
17+
"error": {
18+
"enum": ["invalid-arity", "invalid-type",
19+
"invalid-value", "syntax",
20+
"unknown-function"]
21+
},
22+
"bench": {
23+
"enum": ["parse", "interpret", "full"]
24+
},
25+
"comment": {"type": "string"}
26+
},
27+
"required": ["expression"],
28+
"anyOf": [
29+
{"required": ["result"]},
30+
{"required": ["error"]},
31+
{"required": ["bench"]}
32+
]
33+
}
34+
}
35+
},
36+
"required": ["given", "cases"]
37+
}
38+
}

0 commit comments

Comments
 (0)