Skip to content

Commit 1382890

Browse files
committed
improving documentation about IssueTest
1 parent 75212ac commit 1382890

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ and then you are ready to send a pull request.
4141
In some cases the error you want to report is not about "if a given json is valid against a schema", but instead an inproper validation failure report to be tested. In such case you can create a testcase which contains:
4242
* a `schema.json`
4343
* a `subject-invalid.json`
44-
* an `expectedException.json`
44+
* an `expected-exception.json`
4545

4646
The last one should contain a JSON description of the expected exception. Such an exception description has at most 2 keys:
4747
* `message`: (required) the value is the expected exception message
48-
* `causingExceptions` : (optional) the value is an array of causing exceptions (which are returned by the `ġetCausingExceptions()` method of the expected `ValidationException`). Each item of this entry should also be an exception description, so these are objects with a required `message` and an optional `causingExceptions` key. Example `expectedException.json`:
48+
* `causingExceptions` : (optional) the value is an array of causing exceptions (which are returned by the `ġetCausingExceptions()` method of the expected `ValidationException`). Each item of this entry should also be an exception description, so these are objects with a required `message` and an optional `causingExceptions` key. Example `expected-exception.json`:
4949

5050
```js
5151
{
@@ -72,6 +72,25 @@ The last one should contain a JSON description of the expected exception. Such a
7272
}
7373
```
7474

75+
### Setting validator configuration for integration tests
76+
77+
Aside the above listed files you can also specify a `validator-config.json` file containing information for the testrunner
78+
about how to configure the loader and validator objects while running your test. In most cases you will be fine with the
79+
defaults but in some cases you might need to change defaults. This can contain the following keys (all
80+
of them are optional):
81+
82+
`validator-config.json` reference:
83+
* `"failEarly"` (boolean): if set to `true` the validator will run in early failing mode (`false` by default)
84+
* `"resolutionScope"` : sets the initial resolution scope (implicit top-level `"$id"`)
85+
* `"regexpImplementation"`: if set to `"RE2J"` the validator will use the [RE2J](https://github.com/google/re2j) -based
86+
regexp implementation (otherwise the default `java.util.regex` package is used.
87+
* `"customFormats"` : a json object, each key is a format name, and the value is the fully qualified name of a format class
88+
(implementing `org.everit.json.schema.FormatValidator`) you need to use in your testcase. The class must have a default
89+
constructor. If you utilize this setting then you will also have to include the format class in your PR so that the testrunner
90+
can instantiate it.
91+
* `"metaSchemaVersion"`: can be `4` or `6` or `7`. Setting it to `6` or `7` enables draft-6 and draft-7 support respectively.
92+
93+
7594
## Building the project locally
7695

7796
Prerequisities: the following tools have to be installed:

0 commit comments

Comments
 (0)