Test suite for the VC JSON Schema specification in the W3C.
The suite makes use Digital Bazaar's mocha-w3c-interop-reporter.
To build and test the suite, run the following commands:
npm install
npm test
You can remove all generated test cases by running:
npm clean
A report will be generated to the reports directory after a successful run.
Implementations are tested on two dimensions: support for defined types (JsonSchema
and JsonSchemaCredential
), and
support for specified JSON Schema versions (Draft-7
, 2019-09
, and 2020-12
).
Implementations are run using docker compose. Each container is called once per test case. The container is expected take the following inputs:
format
- eitherJsonSchema
orJsonSchemaCredential
schema
- a path to the input schema filecredential
- a path to the input credential fileoutput
- a path to where the container will write an output
An example command for a container that takes the above inputs would be:
docker-compose -f ./implementations/docker-compose.yml \
run -d tbd validate \
--format JsonSchemaCredential \
--schema /tests/input/jsonschemacredential/Draft-7/11-schema.json \
--credential /tests/input/jsonschemacredential/Draft-7/1-credential.json \
--output /tests/output/jsonschemacredential/Draft-7/18-tbd.json
To add an implementation to the test suite, add a new entry to the implementations
array in implementations.json
.
The entry should have the following properties: name
and specs
, where specs
is an object with the supported
JSON Schema versions as keys and an array of supported
VC JSON Schema Types as values.
{
"name": "sample",
"specs": {
"2020-12": [
"JsonSchema",
"JsonSchemaCredential"
],
"2019-09": [
"JsonSchema",
"JsonSchemaCredential"
],
"Draft-7": [
"JsonSchema",
"JsonSchemaCredential"
]
}
}
Next, you'll need to add a new entry for the implementation in the docker-compose.yml
file. You may optionally add a directory to the implementations
directory with the same name as the
implementation which houses the implementation's code.