Skip to content

Commit 11490df

Browse files
committed
Merge commit 'd97c81177b325010d2a67ad45642f4ff2bf25425'
* commit 'd97c81177b325010d2a67ad45642f4ff2bf25425': Squashed 'json/' changes from 468fa78..0ba6722
2 parents 121056f + d97c811 commit 11490df

File tree

5 files changed

+102
-0
lines changed

5 files changed

+102
-0
lines changed

json/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ This suite is being used by:
6767
* [jsonschema (javascript)](https://github.com/tdegrunt/jsonschema)
6868
* [JaySchema (javascript)](https://github.com/natesilva/jayschema)
6969
* [z-schema (javascript)](https://github.com/zaggino/z-schema)
70+
* [jassi (javascript)](https://github.com/iclanzan/jassi)
71+
* [json-schema-valid (javascript)](https://github.com/ericgj/json-schema-valid)
7072
* [jesse (Erlang)](https://github.com/klarna/jesse)
7173
* [json-schema (PHP)](https://github.com/justinrainbow/json-schema)
7274
* [gojsonschema (Go)](https://github.com/sigu-399/gojsonschema)
7375
* [json_schema (Dart)](https://github.com/patefacio/json_schema)
76+
* [tv4 (JavaScript)](https://github.com/geraintluff/tv4)
77+
* [Jsonary (JavaScript)](https://github.com/jsonary-js/jsonary)
7478

7579
If you use it as well, please fork and send a pull request adding yourself to
7680
the list :).

json/tests/draft3/enum.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,37 @@
3535
"valid": false
3636
}
3737
]
38+
},
39+
{
40+
"description": "enums in properties",
41+
"schema": {
42+
"type":"object",
43+
"properties": {
44+
"foo": {"enum":["foo"]},
45+
"bar": {"enum":["bar"], "required":true}
46+
}
47+
},
48+
"tests": [
49+
{
50+
"description": "both properties are valid",
51+
"data": {"foo":"foo", "bar":"bar"},
52+
"valid": true
53+
},
54+
{
55+
"description": "missing optional property is valid",
56+
"data": {"bar":"bar"},
57+
"valid": true
58+
},
59+
{
60+
"description": "missing required property is invalid",
61+
"data": {"foo":"foo"},
62+
"valid": false
63+
},
64+
{
65+
"description": "missing all properties is invalid",
66+
"data": {},
67+
"valid": false
68+
}
69+
]
3870
}
3971
]

json/tests/draft4/enum.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,38 @@
3535
"valid": false
3636
}
3737
]
38+
},
39+
{
40+
"description": "enums in properties",
41+
"schema": {
42+
"type":"object",
43+
"properties": {
44+
"foo": {"enum":["foo"]},
45+
"bar": {"enum":["bar"]}
46+
},
47+
"required": ["bar"]
48+
},
49+
"tests": [
50+
{
51+
"description": "both properties are valid",
52+
"data": {"foo":"foo", "bar":"bar"},
53+
"valid": true
54+
},
55+
{
56+
"description": "missing optional property is valid",
57+
"data": {"bar":"bar"},
58+
"valid": true
59+
},
60+
{
61+
"description": "missing required property is invalid",
62+
"data": {"foo":"foo"},
63+
"valid": false
64+
},
65+
{
66+
"description": "missing all properties is invalid",
67+
"data": {},
68+
"valid": false
69+
}
70+
]
3871
}
3972
]

json/tests/draft4/not.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,28 @@
6969
"valid": false
7070
}
7171
]
72+
},
73+
{
74+
"description": "forbidden property",
75+
"schema": {
76+
"properties": {
77+
"foo": {
78+
"not": {}
79+
}
80+
}
81+
},
82+
"tests": [
83+
{
84+
"description": "property present",
85+
"data": {"foo": 1, "bar": 2},
86+
"valid": false
87+
},
88+
{
89+
"description": "property absent",
90+
"data": {"bar": 1, "baz": 2},
91+
"valid": true
92+
}
93+
]
7294
}
95+
7396
]

json/tests/draft4/optional/format.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@
7575
"description": "an IP address with out-of-range values",
7676
"data": "256.256.256.256",
7777
"valid": false
78+
},
79+
{
80+
"description": "an IP address without 4 components",
81+
"data": "127.0",
82+
"valid": false
83+
},
84+
{
85+
"description": "an IP address as an integer",
86+
"data": "0x7f000001",
87+
"valid": false
7888
}
7989
]
8090
},

0 commit comments

Comments
 (0)