You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON Schema Test Suite [](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22)
2
-
======
1
+
# JSON Schema Test Suite [](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22)
3
2
4
3
This repository contains a set of JSON objects that implementors of JSON Schema
5
4
validation libraries can use to test their validators.
@@ -9,108 +8,118 @@ It is meant to be language agnostic and should require only a JSON parser.
9
8
The conversion of the JSON objects into tests within your test framework of
10
9
choice is still the job of the validator implementor.
11
10
12
-
Structure of a Test
13
-
-------------------
11
+
## Structure of a Test
14
12
15
-
The tests in this suite are contained in the `tests` directory at the
16
-
root of this repository.
13
+
The tests in this suite are contained in the `tests` directory at the root of
14
+
this repository. Inside that directory is a subdirectory for each draft or
15
+
version of the specification.
17
16
18
-
Inside that directory is a subdirectory for each draft or version of the
19
-
specification.
17
+
Inside each draft directory, there are a number of `.json` files and one or more
18
+
special subdirectories. The subdirectories contain `.json` files meant for a
19
+
specific testing purpose, and each `.json` file logically groups a set of test
20
+
cases together. Often the grouping is by property under test, but not always.
20
21
21
-
Inside each draft directory, there are a number of `.json` files, which
22
-
logically group a set of test cases together. Often the grouping is by
23
-
property under test, but not always, especially within optional test
24
-
files (discussed below).
22
+
The subdirectories are described in the next section.
25
23
26
24
Inside each `.json` file is a single array containing objects. It's easiest to
27
25
illustrate the structure of these with an example:
28
26
29
27
```json
30
-
{
31
-
"description": "the description of the test case",
32
-
"schema": {"the schema that should" : "be validated against"},
33
-
"tests": [
34
-
{
35
-
"description": "a specific test of a valid instance",
36
-
"data": "the instance",
37
-
"valid": true
38
-
},
39
-
{
40
-
"description": "another specific test this time, invalid",
41
-
"data": 15,
42
-
"valid": false
43
-
}
44
-
]
45
-
}
28
+
{
29
+
"description": "The description of the test case",
30
+
"schema": {
31
+
"description": "The schema against which the data in each test is validated",
32
+
"type": "string"
33
+
},
34
+
"tests": [
35
+
{
36
+
"description": "Test for a valid instance",
37
+
"data": "the instance to validate",
38
+
"valid": true
39
+
},
40
+
{
41
+
"description": "Test for an invalid instance",
42
+
"data": 15,
43
+
"valid": false
44
+
}
45
+
]
46
+
}
46
47
```
47
48
48
-
In short: a description, a schema under test, and some tests, where each
49
-
test in the `tests` array is an objects with a description of the case
50
-
itself, the instance under test, and a boolean indicating whether it
51
-
should be valid or invalid.
49
+
In short: a description, a schema under test, and some tests, where each test
50
+
in the `tests` array is an objects with a description of the case itself, the
51
+
instance under test, and a boolean indicating whether it should be valid
52
+
or invalid.
52
53
53
-
Coverage
54
-
--------
54
+
## Test Subdirectories
55
55
56
-
Drafts 07, 06, 04 and 03 should have full coverage, with drafts 06 and
57
-
07 being considered current and actively supported.
56
+
There is currently only one subdirectory that may exist within each draft
57
+
directory. This is:
58
58
59
-
Draft 2019-09 support is under development. Contributions are very
60
-
welcome, especially from implementers as they add support to their own
61
-
implementations.
59
+
1.`optional/`: Contains tests that are considered optional.
62
60
63
-
If you see anything missing from the current supported drafts, or incorrect
64
-
on any draft still accepting bug fixes, please file an issue or submit a PR.
61
+
## Coverage
65
62
66
-
Who Uses the Test Suite
67
-
-----------------------
63
+
Drafts 07, 06, 04, and 03 should have full coverage, with tests for drafts 06,
64
+
07, and 2019-09 being considered current and actively supported. Draft 2019-09
65
+
is almost fully covered.
66
+
67
+
Contributions are very welcome, especially from implementers as they add support
68
+
to their own implementations.
69
+
70
+
If you see anything missing from the current supported drafts, or incorrect on
71
+
any draft still accepting bug fixes, please
72
+
[file an issue](https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues)
73
+
or [submit a PR](https://github.com/json-schema-org/JSON-Schema-Test-Suite).
If you use it as well, please fork and send a pull request adding yourself to
175
189
the list :).
176
190
177
-
Contributing
178
-
------------
191
+
## Contributing
179
192
180
193
If you see something missing or incorrect, a pull request is most welcome!
181
194
182
-
There are some sanity checks in place for testing the test suite. You
183
-
can run them with `bin/jsonschema_suite check` or `tox`. They will be
184
-
run automatically by [GitHub Actions](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22)
195
+
There are some sanity checks in place for testing the test suite. You can run
196
+
them with `bin/jsonschema_suite check` or `tox`. They will be run automatically
197
+
by [GitHub Actions](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22)
0 commit comments