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,110 +8,122 @@ 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
-
If you're going to use this suite, you need to know how tests are laid out. The
16
-
tests are contained in the `tests` directory at the 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
-
schema.
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
-
If you look inside the draft directory, there are a number of `.json` files,
22
-
which logically group a set of test cases together. Often the grouping is by
23
-
property under test, but not always, especially within optional test files
24
-
(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
-
So a description, a schema, and some tests, where tests is an array containing
49
-
one or more objects with descriptions, data, and a boolean indicating whether
50
-
they 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.
51
53
52
-
Coverage
53
-
--------
54
+
## Test Subdirectories
54
55
55
-
Drafts 07, 06, 04 and 03 should have full coverage, with drafts 06 and
56
-
07 being considered current and actively supported.
56
+
There is currently only one subdirectory that may exist within each draft
57
+
directory. This is:
57
58
58
-
Draft 2019-09 support is under development. Contributions are very
59
-
welcome, especially from implementers as they add support to their own
60
-
implementations.
59
+
1.`optional/`: Contains tests that are considered optional.
61
60
62
-
Bug fixes will be made as needed for draft-04 as it is still the most
63
-
widely used, while draft-03 is long since deprecated.
61
+
## Coverage
64
62
65
-
If you see anything missing from the current supported drafts, or incorrect
66
-
on any draft still accepting bug fixes, please file an issue or submit a PR.
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.
67
66
68
-
Who Uses the Test Suite
69
-
-----------------------
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
177
194
the list :).
178
195
179
-
Contributing
180
-
------------
196
+
## Contributing
181
197
182
198
If you see something missing or incorrect, a pull request is most welcome!
183
199
184
-
There are some sanity checks in place for testing the test suite. You
185
-
can run them with `bin/jsonschema_suite check` or `tox`. They will be
186
-
run automatically by [GitHub Actions](https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions?query=workflow%3A%22Test+Suite+Sanity+Checking%22)
200
+
There are some sanity checks in place for testing the test suite. You can run
201
+
them with `bin/jsonschema_suite check` or `tox`. They will be run automatically
202
+
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