Skip to content

Commit 8bff7e3

Browse files
committed
Squashed 'json/' changes from 3481a79..27f8c84
27f8c84 Merge pull request #184 from remexre/master 8fc497e Changes draft06 tests to use draft06 metaschema. 583ecf9 Add name.json to the CLI tool's remotes. 67c7b4d Merge pull request #180 from bismark/patch-1 784198b Update erlang URL 05fdba4 Merge pull request #173 from epoberezkin/format e8ef6fd draft-06: additional format tests d545553 Merge branch 'master' into format bc4de6c Merge pull request #174 from epoberezkin/zero-term f455ecc Merge branch 'master' into zero-term 5f6abf7 draft-06: zero-terminated float test description c1b12bf Merge pull request #160 from epoberezkin/ref-tests 25836f7 update draft-06 tests: "id" -> "$id" 671bad6 fix: JavaScript test 44f6447 Merge branch 'master' into ref-tests 73a0593 Merge pull request #169 from epoberezkin/draft6-tests-ajv e2e06d7 update ajv version, test bd14545 Merge branch 'master' into draft6-tests-ajv cbe0e5b Merge branch 'master' into ref-tests 8758156 Merge pull request #172 from epoberezkin/bignum 19a0b46 Merge pull request #171 from epoberezkin/id e1e1eec draft-06: format "json-pointer" tests 1e2834c draft-06: format "uri-template" tests 21b776e draft-06: format "uri-reference" tests b8165b7 draft-06: option/bignum tests exclusiveMaximum/Minimum updated f04ed0e Merge branch 'master' into draft6-tests-ajv 0931c60 test: run draft-04/06 tests with ajv da8b14e Merge pull request #170 from epoberezkin/boolean 20d706c Merge pull request #163 from epoberezkin/boundary-point ae72865 Merge pull request #168 from korzio/patch-1 f809e51 draft-06: $id keyword 04d7e06 Add djv validator to readme e86adb2 draft-06: $ref to boolean schemas d62b754 draft-06: allOf, anyOf, oneOf keywords with boolean schemas b714a18 draft-06: not keyword with boolean schemas b6b00f9 draft-06: contains keyword with boolean schemas 9c05d18 draft-06: propertyNames keyword with boolean schemas fa99135 draft-06: patternProperties keyword with boolean schemas 5a888a6 draft-06: dependencies keyword with boolean subschemas 53858ff draft-06: items keyword with boolean schemas afd6fab Merge pull request #167 from json-schema-org/revert-123-relative-ref-id 3b9b688 Revert "Test relative reference resolution when ID is not present" 77e0411 draft-06: properties keyword with boolean schemas cff24c1 Merge pull request #123 from yuloh/relative-ref-id e7c1f4e Merge pull request #161 from epoberezkin/items 43bfc6b Merge pull request #165 from epoberezkin/test-schema 6956f20 draft-06: boolean root schema e1139a3 update test-schema to draft-04 042fae9 Merge pull request #164 from epoberezkin/zero-terminated 78de3a6 draft-06: zero-terminated float is a valid integer 9d998bb draft-04: added maximum/minimum tests for boundary point b8f51ab Merge pull request #151 from epoberezkin/exclusive-limits 951bd41 Merge pull request #154 from epoberezkin/property-names b974907 Merge pull request #159 from epoberezkin/empty-property-list 9b1364e Merge pull request #158 from epoberezkin/contains 95b4648 Merge pull request #157 from epoberezkin/const 85efafb draft-06: required and dependencies with empty property arrays 7e40f2e draft-06: exclusiveMaximum and exclusiveMinimum validation 0058644 draft-06: propertyNames validation ba6c582 draft-06: const validation 9867b96 draft-06: contains keyword validation 96fed74 draft-04/06: updated descriptions for items/additionalItems test cases 0799212 Make the URI tests consistent with themselves. 65c18d5 draft-04/06: items/additionalItems tests 3186761 draft-04/06: root ref "#" in remote ref 0178c74 draft-04/06: recursive refs test a884acc draft-04/06: base URI change tests 12ab007 Update to the new organization. a599e1e Flip protocol-relative URI Reference (not a URI) ed3391c Merge pull request #150 from handrews/draft6 555dfd3 Initialize draft6 tests from draft4. 5363098 Merge remote-tracking branch 'pboettch/master' 2ba2657 Merge remote-tracking branch 'agebhar1/feature/java+everit-org' f7cec5a Merge remote-tracking branch 'agebhar1/feature/java+networknt' 16a8c1b Merge pull request #145 from agebhar1/feature/java+json-schema-validator 6d29eb2 add `networknt/json-schema-validator` to test suite users b38690a add `everit-org/json-schema` to test suite users 5637345 update Java's `json-schema-validator` repository 5a2c708 Added 'Modern C++ JSON schema validator' 371977c Merge branch 'develop' e2618a0 Merge pull request #142 from pipobscure/refOnly b24fae2 When $ref is present other keywords should be ignored cb25a4e Merge pull request #134 from zloster/develop 1e9db5e Add optional check for non-ECMA 262 regular expressions efb3c89 Merge pull request #127 from iainbeeston/extra-items-tests 27692ac Merge pull request #133 from gavinwahl/develop fc7584e add postgres-json-schema 654cc26 Added tests for items when data contains more or less types than the schema 5fb3d9f Merge pull request #125 from yuloh/ref-property 833a70c Merge pull request #126 from gregsdennis/develop 302da1e Added Manatee.Json as .Net implementor. dc001c2 Add test for properties named $ref 6d366dc Test relative reference resolution 9355965 Merge pull request #120 from seagreen/extract-test-schema 42ba0f9 Extract the schema for tests into a JSON file. 2f0d6e3 Merge pull request #118 from yuloh/ignores-non-objects-required cc52997 Test required ignores non objects 27ed651 Merge pull request #117 from tatut/develop c9f5dcd Add Clojure json-schema to users 8549899 Merge pull request #116 from yuloh/patch-1 de70a75 Add league/json-guard implementation for PHP 9723c8f Merge pull request #111 from Relequestual/patch-1 9d5909a Also check string "1" is not a number in draft 4 e4ab5bd Check that a string of "1" is not a number 5dc71b8 Merge pull request #108 from duksis/patch-1 6a054cd Adds ex_json_schema validator for Elixir f3d5aeb Merge branch 'develop' 5bcf11a Port to draft4. 3f7ed81 Merge pull request #103 from Relequestual/patch-1 928d3b0 Fixed incorrect negative description of a sub test 62414e4 Minor shuffling. a7305a6 Merge remote-tracking branch 'legoktm/tox' into develop 5cc622c Merge pull request #100 from atomiqio/develop 2f51b2e updated node.js info in README.md 8f29757 Add the README note on develop. 338eef3 Merge pull request #97 from atomiqio/develop 146e291 JavaScript should written in upper camel case 7511038 Merge pull request #95 from epoberezkin/develop ca28bbb added ajv validator to readme 504f776 Merge pull request #93 from gelraen/readme 59207fd Add another Go implementation d14cf96 Use tox to run tests git-subtree-dir: json git-subtree-split: 27f8c840acdb3700de7173981e95ed90ef28de2e
1 parent 7afa6f0 commit 8bff7e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4016
-56
lines changed

Diff for: .travis.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
language: python
22
python: "2.7"
3-
install: pip install jsonschema
4-
script: bin/jsonschema_suite check
3+
node_js: "6"
4+
install:
5+
- pip install tox
6+
- npm install
7+
script:
8+
- tox
9+
- npm test

Diff for: README.md

+36-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite.png?branch=develop)](https://travis-ci.org/json-schema/JSON-Schema-Test-Suite)
1+
JSON Schema Test Suite [![Build Status](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite.svg?branch=master)](https://travis-ci.org/json-schema-org/JSON-Schema-Test-Suite)
22
======================
33

44
This repository contains a set of JSON objects that implementors of JSON Schema
@@ -64,17 +64,26 @@ This suite is being used by:
6464

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

67+
### C++ ###
68+
69+
* [Modern C++ JSON schema validator](https://github.com/pboettch/json-schema-validator)
70+
6771
### Dart ###
6872

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

75+
### Elixir ###
76+
77+
* [ex_json_schema](https://github.com/jonasschmidt/ex_json_schema)
78+
7179
### Erlang ###
7280

73-
* [jesse](https://github.com/klarna/jesse)
81+
* [jesse](https://github.com/for-GET/jesse)
7482

7583
### Go ###
7684

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

7988
### Haskell ###
8089

@@ -83,9 +92,11 @@ This suite is being used by:
8392

8493
### Java ###
8594

86-
* [json-schema-validator](https://github.com/fge/json-schema-validator)
95+
* [json-schema-validator](https://github.com/daveclayton/json-schema-validator)
96+
* [everit-org/json-schema](https://github.com/everit-org/json-schema)
97+
* [networknt/json-schema-validator](https://github.com/networknt/json-schema-validator)
8798

88-
### Javascript ###
99+
### JavaScript ###
89100

90101
* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
91102
* [direct-schema](https://github.com/IreneKnapp/direct-schema)
@@ -100,14 +111,26 @@ This suite is being used by:
100111
* [tv4](https://github.com/geraintluff/tv4)
101112
* [z-schema](https://github.com/zaggino/z-schema)
102113
* [jsen](https://github.com/bugventure/jsen)
114+
* [ajv](https://github.com/epoberezkin/ajv)
115+
* [djv](https://github.com/korzio/djv)
116+
117+
### Node.js ###
118+
119+
The JSON Schema Test Suite is also available as an
120+
[npm](https://www.npmjs.com/package/json-schema-test-suite) package.
121+
Node-specific support is maintained on the [node branch](https://github.com/json-schema-org/JSON-Schema-Test-Suite/tree/node).
122+
See [NODE-README.md](https://github.com/json-schema-org/JSON-Schema-Test-Suite/blob/node/NODE-README.md)
123+
for more information.
103124

104125
### .NET ###
105126

106127
* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)
128+
* [Manatee.Json](https://github.com/gregsdennis/Manatee.Json)
107129

108130
### PHP ###
109131

110132
* [json-schema](https://github.com/justinrainbow/json-schema)
133+
* [json-guard](https://github.com/thephpleague/json-guard)
111134

112135
### Python ###
113136

@@ -125,6 +148,14 @@ This suite is being used by:
125148

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

151+
### Clojure ###
152+
153+
* [json-schema](https://github.com/tatut/json-schema)
154+
155+
### PostgreSQL ###
156+
157+
* [postgres-json-schema](https://github.com/gavinwahl/postgres-json-schema)
158+
128159
If you use it as well, please fork and send a pull request adding yourself to
129160
the list :).
130161

@@ -134,5 +165,5 @@ Contributing
134165
If you see something missing or incorrect, a pull request is most welcome!
135166

136167
There are some sanity checks in place for testing the test suite. You can run
137-
them with `bin/jsonschema_suite check`. They will be run automatically by
168+
them with `bin/jsonschema_suite check && npm test` or `tox && npm test`. They will be run automatically by
138169
[Travis CI](https://travis-ci.org/) as well.

Diff for: bin/jsonschema_suite

+28-37
Original file line numberDiff line numberDiff line change
@@ -38,47 +38,29 @@ else:
3838
)
3939

4040

41-
ROOT_DIR = os.path.join(
42-
os.path.dirname(__file__), os.pardir).rstrip("__pycache__")
41+
ROOT_DIR = os.path.abspath(
42+
os.path.join(os.path.dirname(__file__), os.pardir).rstrip("__pycache__"),
43+
)
4344
SUITE_ROOT_DIR = os.path.join(ROOT_DIR, "tests")
4445

4546
REMOTES = {
46-
"integer.json": {"type": "integer"},
47+
"integer.json": {u"type": u"integer"},
48+
"name.json": {
49+
u"type": "string",
50+
u"definitions": {
51+
u"orNull": {u"anyOf": [{u"type": u"null"}, {u"$ref": u"#"}]},
52+
},
53+
},
4754
"subSchemas.json": {
48-
"integer": {"type": "integer"},
49-
"refToInteger": {"$ref": "#/integer"},
55+
u"integer": {u"type": u"integer"},
56+
u"refToInteger": {u"$ref": u"#/integer"},
5057
},
51-
"folder/folderInteger.json": {"type": "integer"}
58+
"folder/folderInteger.json": {u"type": u"integer"}
5259
}
5360
REMOTES_DIR = os.path.join(ROOT_DIR, "remotes")
5461

55-
TESTSUITE_SCHEMA = {
56-
"$schema": "http://json-schema.org/draft-03/schema#",
57-
"type": "array",
58-
"items": {
59-
"type": "object",
60-
"properties": {
61-
"description": {"type": "string", "required": True},
62-
"schema": {"required": True},
63-
"tests": {
64-
"type": "array",
65-
"items": {
66-
"type": "object",
67-
"properties": {
68-
"description": {"type": "string", "required": True},
69-
"data": {"required": True},
70-
"valid": {"type": "boolean", "required": True}
71-
},
72-
"additionalProperties": False
73-
},
74-
"minItems": 1
75-
}
76-
},
77-
"additionalProperties": False,
78-
"minItems": 1
79-
}
80-
}
81-
62+
with open(os.path.join(ROOT_DIR, "test-schema.json")) as schema:
63+
TESTSUITE_SCHEMA = json.load(schema)
8264

8365
def files(paths):
8466
for path in paths:
@@ -164,10 +146,19 @@ class SanityTests(unittest.TestCase):
164146
self.fail(str(error))
165147

166148
def test_remote_schemas_are_updated(self):
167-
for url, schema in REMOTES.items():
168-
filepath = os.path.join(REMOTES_DIR, url)
169-
with open(filepath) as schema_file:
170-
self.assertEqual(json.load(schema_file), schema)
149+
files = {}
150+
for parent, _, paths in os.walk(REMOTES_DIR):
151+
for path in paths:
152+
absolute_path = os.path.join(parent, path)
153+
with open(absolute_path) as schema_file:
154+
files[absolute_path] = json.load(schema_file)
155+
156+
self.assertEqual(
157+
files, {
158+
os.path.join(REMOTES_DIR, path): contents
159+
for path, contents in REMOTES.iteritems()
160+
},
161+
)
171162

172163

173164
def main(arguments):

Diff for: index.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
'use strict';
2+
3+
var Ajv = require('ajv');
4+
var jsonSchemaTest = require('json-schema-test');
5+
var assert = require('assert');
6+
7+
var refs = {
8+
'http://localhost:1234/integer.json': require('./remotes/integer.json'),
9+
'http://localhost:1234/subSchemas.json': require('./remotes/subSchemas.json'),
10+
'http://localhost:1234/folder/folderInteger.json': require('./remotes/folder/folderInteger.json'),
11+
'http://localhost:1234/name.json': require('./remotes/name.json')
12+
};
13+
14+
runTest(4);
15+
runTest(6);
16+
17+
function runTest(draft) {
18+
var opts = {format: 'full'};
19+
if (draft == 4) opts.meta = false;
20+
var ajv = new Ajv(opts);
21+
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
22+
if (draft == 4) ajv._opts.defaultMeta = 'http://json-schema.org/draft-04/schema#';
23+
for (var uri in refs) ajv.addSchema(refs[uri], uri);
24+
25+
jsonSchemaTest(ajv, {
26+
description: 'Test suite draft-0' + draft,
27+
suites: {tests: './tests/draft' + draft + '/{**/,}*.json'},
28+
skip: draft == 4 ? ['optional/zeroTerminatedFloats'] : [],
29+
cwd: __dirname,
30+
hideFolder: 'tests/'
31+
});
32+
}

Diff for: package.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "json-schema-test-suite",
3+
"version": "0.1.0",
4+
"description": "A language agnostic test suite for the JSON Schema specifications",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "mocha index.js -R spec"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/json-schema-org/JSON-Schema-Test-Suite.git"
12+
},
13+
"keywords": [
14+
"json-schema",
15+
"tests"
16+
],
17+
"author": "http://json-schema.org",
18+
"license": "MIT",
19+
"bugs": {
20+
"url": "https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues"
21+
},
22+
"homepage": "https://github.com/json-schema-org/JSON-Schema-Test-Suite#readme",
23+
"devDependencies": {
24+
"ajv": "^5.0.4-beta.1",
25+
"json-schema-test": "^1.3.0",
26+
"mocha": "^3.2.0"
27+
}
28+
}

Diff for: remotes/name.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"definitions": {
3+
"orNull": {
4+
"anyOf": [
5+
{"type": "null"},
6+
{"$ref": "#"}
7+
]
8+
}
9+
},
10+
"type": "string"
11+
}

Diff for: test-schema.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"type": "array",
4+
"items": {
5+
"type": "object",
6+
"required": ["description", "schema", "tests"],
7+
"properties": {
8+
"description": {"type": "string"},
9+
"schema": {},
10+
"tests": {
11+
"type": "array",
12+
"items": {
13+
"type": "object",
14+
"required": ["description", "data", "valid"],
15+
"properties": {
16+
"description": {"type": "string"},
17+
"data": {},
18+
"valid": {"type": "boolean"}
19+
},
20+
"additionalProperties": false
21+
},
22+
"minItems": 1
23+
}
24+
},
25+
"additionalProperties": false,
26+
"minItems": 1
27+
}
28+
}

Diff for: tests/draft3/optional/format.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@
7878
"valid": true
7979
},
8080
{
81-
"description": "a valid protocol-relative URI",
81+
"description": "an invalid protocol-relative URI Reference",
8282
"data": "//foo.bar/?baz=qux#quux",
83-
"valid": true
83+
"valid": false
8484
},
8585
{
8686
"description": "an invalid URI",

Diff for: tests/draft3/ref.json

+33
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,39 @@
140140
}
141141
]
142142
},
143+
{
144+
"description": "ref overrides any sibling keywords",
145+
"schema": {
146+
"definitions": {
147+
"reffed": {
148+
"type": "array"
149+
}
150+
},
151+
"properties": {
152+
"foo": {
153+
"$ref": "#/definitions/reffed",
154+
"maxItems": 2
155+
}
156+
}
157+
},
158+
"tests": [
159+
{
160+
"description": "remote ref valid",
161+
"data": { "foo": [] },
162+
"valid": true
163+
},
164+
{
165+
"description": "remote ref valid, maxItems ignored",
166+
"data": { "foo": [ 1, 2, 3] },
167+
"valid": true
168+
},
169+
{
170+
"description": "ref invalid",
171+
"data": { "foo": "string" },
172+
"valid": false
173+
}
174+
]
175+
},
143176
{
144177
"description": "remote ref, containing refs itself",
145178
"schema": {"$ref": "http://json-schema.org/draft-03/schema#"},

0 commit comments

Comments
 (0)