Skip to content

Commit

Permalink
Add Information for Validating a Claim (#2)
Browse files Browse the repository at this point in the history
jsonschema is a standards-based tool used to verify a JSON input file
against a given schema.  This change involves documentation to describe
how to validate a claim.  A standard, off the shelf tool was preferred
to keep this task simple.

Signed-off-by: Ryan Goulding <[email protected]>
Issue-Id: CTONET-547
  • Loading branch information
ryandgoulding authored Oct 26, 2020
1 parent d7e7bb6 commit 0ae6108
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,34 @@ A claim contains:
* All test configurations used by tests.
* All tests run, and their respective results.
* An end time for the claim evaluation.

## Validating a claim

### Requirements

[`jsonschema`](https://python-jsonschema.readthedocs.io/en/stable/) must be installed and made available in `$PATH`.

In order to install `jsonschema`, issue the following command:

```shell script
> pip3 install jsonschema
```

### Running the validation utility

In order to validate a given schema, issue the following command:

```shell script
> jsonschema -i <path_to_claim_file> ./claim-schema.json
```

For a successful validation of the input claim, one should expect no output and a `0` exit code.

```shell script
> jsonschema -i ./sample.json ./claim-schema.json
> echo $?
0
>
```

If the claim does not adhere to the schema, `jsconschema` outputs an appropriate error message describing the issue.
2 changes: 1 addition & 1 deletion claim-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
]
}
}
}
}

0 comments on commit 0ae6108

Please sign in to comment.