Skip to content

Commit 147da3d

Browse files
authored
Merge pull request #1 from json-schema-org/master
update to latest
2 parents 432eab6 + 1bd999a commit 147da3d

36 files changed

+1925
-16
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ Who Uses the Test Suite
6565

6666
This suite is being used by:
6767

68+
### Clojure ###
69+
70+
* [json-schema](https://github.com/tatut/json-schema)
71+
* [JSON Schema for Clojure(Script) (JUXT)](https://github.com/juxt/json-schema)
72+
6873
### Coffeescript ###
6974

7075
* [jsck](https://github.com/pandastrike/jsck)
@@ -138,6 +143,11 @@ for more information.
138143
* [json-schema](https://github.com/justinrainbow/json-schema)
139144
* [json-guard](https://github.com/thephpleague/json-guard)
140145

146+
### PostgreSQL ###
147+
148+
* [postgres-json-schema](https://github.com/gavinwahl/postgres-json-schema)
149+
* [is_jsonb_valid](https://github.com/furstenheim/is_jsonb_valid)
150+
141151
### Python ###
142152

143153
* [jsonschema](https://github.com/Julian/jsonschema)
@@ -155,15 +165,6 @@ for more information.
155165

156166
* [JSONSchema](https://github.com/kylef/JSONSchema.swift)
157167

158-
### Clojure ###
159-
160-
* [json-schema](https://github.com/tatut/json-schema)
161-
162-
### PostgreSQL ###
163-
164-
* [postgres-json-schema](https://github.com/gavinwahl/postgres-json-schema)
165-
* [is_jsonb_valid](https://github.com/furstenheim/is_jsonb_valid)
166-
167168
If you use it as well, please fork and send a pull request adding yourself to
168169
the list :).
169170

bin/jsonschema_suite

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class SanityTests(unittest.TestCase):
125125

126126
@unittest.skipIf(jsonschema is None, "Validation library not present!")
127127
def test_suites_are_valid(self):
128-
validator = jsonschema.Draft3Validator(TESTSUITE_SCHEMA)
128+
validator = jsonschema.Draft4Validator(TESTSUITE_SCHEMA)
129129
for tests in files(self.test_files):
130130
try:
131131
validator.validate(tests)

tests/draft3/minimum.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,36 @@
3838
"valid": false
3939
}
4040
]
41+
},
42+
{
43+
"description": "minimum validation with signed integer",
44+
"schema": {"minimum": -2},
45+
"tests": [
46+
{
47+
"description": "negative above the minimum is valid",
48+
"data": -1,
49+
"valid": true
50+
},
51+
{
52+
"description": "positive above the minimum is valid",
53+
"data": 0,
54+
"valid": true
55+
},
56+
{
57+
"description": "boundary point is valid",
58+
"data": -2,
59+
"valid": true
60+
},
61+
{
62+
"description": "below the minimum is invalid",
63+
"data": -3,
64+
"valid": false
65+
},
66+
{
67+
"description": "ignores non-numbers",
68+
"data": "x",
69+
"valid": true
70+
}
71+
]
4172
}
4273
]

tests/draft4/allOf.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,5 +108,78 @@
108108
"valid": false
109109
}
110110
]
111+
},
112+
{
113+
"description": "allOf with one empty schema",
114+
"schema": {
115+
"allOf": [
116+
{}
117+
]
118+
},
119+
"tests": [
120+
{
121+
"description": "any data is valid",
122+
"data": 1,
123+
"valid": true
124+
}
125+
]
126+
},
127+
{
128+
"description": "allOf with two empty schemas",
129+
"schema": {
130+
"allOf": [
131+
{},
132+
{}
133+
]
134+
},
135+
"tests": [
136+
{
137+
"description": "any data is valid",
138+
"data": 1,
139+
"valid": true
140+
}
141+
]
142+
},
143+
{
144+
"description": "allOf with the first empty schema",
145+
"schema": {
146+
"allOf": [
147+
{},
148+
{ "type": "number" }
149+
]
150+
},
151+
"tests": [
152+
{
153+
"description": "number is valid",
154+
"data": 1,
155+
"valid": true
156+
},
157+
{
158+
"description": "string is invalid",
159+
"data": "foo",
160+
"valid": false
161+
}
162+
]
163+
},
164+
{
165+
"description": "allOf with the last empty schema",
166+
"schema": {
167+
"allOf": [
168+
{ "type": "number" },
169+
{}
170+
]
171+
},
172+
"tests": [
173+
{
174+
"description": "number is valid",
175+
"data": 1,
176+
"valid": true
177+
},
178+
{
179+
"description": "string is invalid",
180+
"data": "foo",
181+
"valid": false
182+
}
183+
]
111184
}
112185
]

tests/draft4/anyOf.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,26 @@
105105
"valid": false
106106
}
107107
]
108+
},
109+
{
110+
"description": "anyOf with one empty schema",
111+
"schema": {
112+
"anyOf": [
113+
{ "type": "number" },
114+
{}
115+
]
116+
},
117+
"tests": [
118+
{
119+
"description": "string is valid",
120+
"data": "foo",
121+
"valid": true
122+
},
123+
{
124+
"description": "number is valid",
125+
"data": 123,
126+
"valid": true
127+
}
128+
]
108129
}
109130
]

tests/draft4/dependencies.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,76 @@
119119
"valid": false
120120
}
121121
]
122+
},
123+
{
124+
"description": "dependencies with escaped characters",
125+
"schema": {
126+
"dependencies": {
127+
"foo\nbar": ["foo\rbar"],
128+
"foo\tbar": {
129+
"minProperties": 4
130+
},
131+
"foo'bar": {"required": ["foo\"bar"]},
132+
"foo\"bar": ["foo'bar"]
133+
}
134+
},
135+
"tests": [
136+
{
137+
"description": "valid object 1",
138+
"data": {
139+
"foo\nbar": 1,
140+
"foo\rbar": 2
141+
},
142+
"valid": true
143+
},
144+
{
145+
"description": "valid object 2",
146+
"data": {
147+
"foo\tbar": 1,
148+
"a": 2,
149+
"b": 3,
150+
"c": 4
151+
},
152+
"valid": true
153+
},
154+
{
155+
"description": "valid object 3",
156+
"data": {
157+
"foo'bar": 1,
158+
"foo\"bar": 2
159+
},
160+
"valid": true
161+
},
162+
{
163+
"description": "invalid object 1",
164+
"data": {
165+
"foo\nbar": 1,
166+
"foo": 2
167+
},
168+
"valid": false
169+
},
170+
{
171+
"description": "invalid object 2",
172+
"data": {
173+
"foo\tbar": 1,
174+
"a": 2
175+
},
176+
"valid": false
177+
},
178+
{
179+
"description": "invalid object 3",
180+
"data": {
181+
"foo'bar": 1
182+
},
183+
"valid": false
184+
},
185+
{
186+
"description": "invalid object 4",
187+
"data": {
188+
"foo\"bar": 2
189+
},
190+
"valid": false
191+
}
192+
]
122193
}
123194
]

tests/draft4/enum.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,28 @@
6868
"valid": false
6969
}
7070
]
71+
},
72+
{
73+
"description": "enum with escaped characters",
74+
"schema": {
75+
"enum": ["foo\nbar", "foo\rbar"]
76+
},
77+
"tests": [
78+
{
79+
"description": "member 1 is valid",
80+
"data": "foo\nbar",
81+
"valid": true
82+
},
83+
{
84+
"description": "member 2 is valid",
85+
"data": "foo\rbar",
86+
"valid": true
87+
},
88+
{
89+
"description": "another string is invalid",
90+
"data": "abc",
91+
"valid": false
92+
}
93+
]
7194
}
7295
]

0 commit comments

Comments
 (0)