Skip to content

Commit

Permalink
Update json schema suite and add perf test
Browse files Browse the repository at this point in the history
  • Loading branch information
miloyip committed Jan 29, 2016
1 parent 89106a1 commit a006648
Show file tree
Hide file tree
Showing 24 changed files with 602 additions and 29 deletions.
91 changes: 75 additions & 16 deletions bin/jsonschema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,80 @@ Who Uses the Test Suite

This suite is being used by:

* [json-schema-validator (Java)](https://github.com/fge/json-schema-validator)
* [jsonschema (python)](https://github.com/Julian/jsonschema)
* [aeson-schema (haskell)](https://github.com/timjb/aeson-schema)
* [direct-schema (javascript)](https://github.com/IreneKnapp/direct-schema)
* [jsonschema (javascript)](https://github.com/tdegrunt/jsonschema)
* [JaySchema (javascript)](https://github.com/natesilva/jayschema)
* [z-schema (javascript)](https://github.com/zaggino/z-schema)
* [jassi (javascript)](https://github.com/iclanzan/jassi)
* [json-schema-valid (javascript)](https://github.com/ericgj/json-schema-valid)
* [jesse (Erlang)](https://github.com/klarna/jesse)
* [json-schema (PHP)](https://github.com/justinrainbow/json-schema)
* [gojsonschema (Go)](https://github.com/sigu-399/gojsonschema)
* [json_schema (Dart)](https://github.com/patefacio/json_schema)
* [tv4 (JavaScript)](https://github.com/geraintluff/tv4)
* [Jsonary (JavaScript)](https://github.com/jsonary-js/jsonary)
### Coffeescript ###

* [jsck](https://github.com/pandastrike/jsck)

### Dart ###

* [json_schema](https://github.com/patefacio/json_schema)

### Erlang ###

* [jesse](https://github.com/klarna/jesse)

### Go ###

* [gojsonschema](https://github.com/sigu-399/gojsonschema)
* [validate-json](https://github.com/cesanta/validate-json)

### Haskell ###

* [aeson-schema](https://github.com/timjb/aeson-schema)
* [hjsonschema](https://github.com/seagreen/hjsonschema)

### Java ###

* [json-schema-validator](https://github.com/fge/json-schema-validator)

### JavaScript ###

* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
* [direct-schema](https://github.com/IreneKnapp/direct-schema)
* [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)
* [jassi](https://github.com/iclanzan/jassi)
* [JaySchema](https://github.com/natesilva/jayschema)
* [json-schema-valid](https://github.com/ericgj/json-schema-valid)
* [Jsonary](https://github.com/jsonary-js/jsonary)
* [jsonschema](https://github.com/tdegrunt/jsonschema)
* [request-validator](https://github.com/bugventure/request-validator)
* [skeemas](https://github.com/Prestaul/skeemas)
* [tv4](https://github.com/geraintluff/tv4)
* [z-schema](https://github.com/zaggino/z-schema)
* [jsen](https://github.com/bugventure/jsen)
* [ajv](https://github.com/epoberezkin/ajv)

### Node.js ###

The JSON Schema Test Suite is also available as an
[npm](https://www.npmjs.com/package/json-schema-test-suite) package.
Node-specific support is maintained on the [node branch](https://github.com/json-schema/JSON-Schema-Test-Suite/tree/node).
See [NODE-README.md](https://github.com/json-schema/JSON-Schema-Test-Suite/blob/node/NODE-README.md)
for more information.

### .NET ###

* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)

### PHP ###

* [json-schema](https://github.com/justinrainbow/json-schema)

### Python ###

* [jsonschema](https://github.com/Julian/jsonschema)

### Ruby ###

* [json-schema](https://github.com/hoxworth/json-schema)

### Rust ###

* [valico](https://github.com/rustless/valico)

### Swift ###

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

If you use it as well, please fork and send a pull request adding yourself to
the list :).
Expand All @@ -85,5 +144,5 @@ Contributing
If you see something missing or incorrect, a pull request is most welcome!

There are some sanity checks in place for testing the test suite. You can run
them with `bin/jsonschema_suite check`. They will be run automatically by
them with `bin/jsonschema_suite check` or `tox`. They will be run automatically by
[Travis CI](https://travis-ci.org/) as well.
Empty file modified bin/jsonschema/bin/jsonschema_suite
100644 → 100755
Empty file.
Binary file added bin/jsonschema/remotes/.DS_Store
Binary file not shown.
Binary file added bin/jsonschema/tests/.DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions bin/jsonschema/tests/draft3/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@
}
]
},
{
"description":
"additionalProperties can exist by itself",
"schema": {
"additionalProperties": {"type": "boolean"}
},
"tests": [
{
"description": "an additional valid property is valid",
"data": {"foo" : true},
"valid": true
},
{
"description": "an additional invalid property is invalid",
"data": {"foo" : 1},
"valid": false
}
]
},
{
"description": "additionalProperties are allowed by default",
"schema": {"properties": {"foo": {}, "bar": {}}},
Expand Down
49 changes: 49 additions & 0 deletions bin/jsonschema/tests/draft3/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[
{
"description": "invalid type for default",
"schema": {
"properties": {
"foo": {
"type": "integer",
"default": []
}
}
},
"tests": [
{
"description": "valid when property is specified",
"data": {"foo": 13},
"valid": true
},
{
"description": "still valid when the invalid default is used",
"data": {},
"valid": true
}
]
},
{
"description": "invalid string value for default",
"schema": {
"properties": {
"bar": {
"type": "string",
"minLength": 4,
"default": "bad"
}
}
},
"tests": [
{
"description": "valid when property is specified",
"data": {"bar": "good"},
"valid": true
},
{
"description": "still valid when the invalid default is used",
"data": {},
"valid": true
}
]
}
]
47 changes: 47 additions & 0 deletions bin/jsonschema/tests/draft3/optional/bignum.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@
}
]
},
{
"description": "integer",
"schema": {"type": "integer"},
"tests": [
{
"description": "a negative bignum is an integer",
"data": -12345678910111213141516171819202122232425262728293031,
"valid": true
}
]
},
{
"description": "number",
"schema": {"type": "number"},
"tests": [
{
"description": "a negative bignum is a number",
"data": -98249283749234923498293171823948729348710298301928331,
"valid": true
}
]
},
{
"description": "string",
"schema": {"type": "string"},
Expand Down Expand Up @@ -56,5 +78,30 @@
"valid": false
}
]
},
{
"description": "integer comparison",
"schema": {"minimum": -18446744073709551615},
"tests": [
{
"description": "comparison works for very negative numbers",
"data": -18446744073709551600,
"valid": true
}
]
},
{
"description": "float comparison with high precision on negative numbers",
"schema": {
"minimum": -972783798187987123879878123.18878137,
"exclusiveMinimum": true
},
"tests": [
{
"description": "comparison works for very negative numbers",
"data": -972783798187987123879878123.188781371,
"valid": false
}
]
}
]
5 changes: 5 additions & 0 deletions bin/jsonschema/tests/draft3/optional/format.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
"data": "http://foo.bar/?baz=qux#quux",
"valid": true
},
{
"description": "a valid protocol-relative URI",
"data": "//foo.bar/?baz=qux#quux",
"valid": true
},
{
"description": "an invalid URI",
"data": "\\\\WINDOWS\\fileshare",
Expand Down
11 changes: 11 additions & 0 deletions bin/jsonschema/tests/draft3/pattern.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,16 @@
"valid": true
}
]
},
{
"description": "pattern is not anchored",
"schema": {"pattern": "a+"},
"tests": [
{
"description": "matches a substring",
"data": "xxaayy",
"valid": true
}
]
}
]
21 changes: 18 additions & 3 deletions bin/jsonschema/tests/draft3/ref.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,34 @@
},
"tests": [
{
"description": "slash",
"description": "slash invalid",
"data": {"slash": "aoeu"},
"valid": false
},
{
"description": "tilda",
"description": "tilda invalid",
"data": {"tilda": "aoeu"},
"valid": false
},
{
"description": "percent",
"description": "percent invalid",
"data": {"percent": "aoeu"},
"valid": false
},
{
"description": "slash valid",
"data": {"slash": 123},
"valid": true
},
{
"description": "tilda valid",
"data": {"tilda": 123},
"valid": true
},
{
"description": "percent valid",
"data": {"percent": 123},
"valid": true
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions bin/jsonschema/tests/draft3/type.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
"valid": false
},
{
"description": "an array is not an array",
"description": "an array is an array",
"data": [],
"valid": true
},
Expand Down Expand Up @@ -234,7 +234,7 @@
"valid": false
},
{
"description": "a boolean is not a boolean",
"description": "a boolean is a boolean",
"data": true,
"valid": true
},
Expand Down
Binary file added bin/jsonschema/tests/draft4/.DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions bin/jsonschema/tests/draft4/additionalProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@
}
]
},
{
"description":
"additionalProperties can exist by itself",
"schema": {
"additionalProperties": {"type": "boolean"}
},
"tests": [
{
"description": "an additional valid property is valid",
"data": {"foo" : true},
"valid": true
},
{
"description": "an additional invalid property is invalid",
"data": {"foo" : 1},
"valid": false
}
]
},
{
"description": "additionalProperties are allowed by default",
"schema": {"properties": {"foo": {}, "bar": {}}},
Expand Down
49 changes: 49 additions & 0 deletions bin/jsonschema/tests/draft4/default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[
{
"description": "invalid type for default",
"schema": {
"properties": {
"foo": {
"type": "integer",
"default": []
}
}
},
"tests": [
{
"description": "valid when property is specified",
"data": {"foo": 13},
"valid": true
},
{
"description": "still valid when the invalid default is used",
"data": {},
"valid": true
}
]
},
{
"description": "invalid string value for default",
"schema": {
"properties": {
"bar": {
"type": "string",
"minLength": 4,
"default": "bad"
}
}
},
"tests": [
{
"description": "valid when property is specified",
"data": {"bar": "good"},
"valid": true
},
{
"description": "still valid when the invalid default is used",
"data": {},
"valid": true
}
]
}
]
Loading

0 comments on commit a006648

Please sign in to comment.