-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#40: added Readme file for schema validation tool
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
## Schema Generation and Validation | ||
|
||
```bash | ||
$ reso-certification-utils schema --help | ||
|
||
Usage: reso-certification-utils schema [options] | ||
|
||
Generate a schema or validate a payload against a schema | ||
|
||
Options: | ||
-g, --generate Generate JSON schema from a metadata report | ||
-v, --validate Validate a payload against a generated schema | ||
-m, --metadataPath <string> Path to the metadata report JSON file | ||
-o, --outputPath <string> Path tho the directory to store the generated schema | ||
-p, --payloadPath <string> Path to the payload that needs to be validated | ||
-s, --schemaPath <string> Path to the generated JSON schema | ||
-e, --errorPath <string> Path to save error reports in case of failed validation | ||
-a, --additionalProperties Pass this flag to allow additional properties in the schema | ||
-r, --resource <string> The resource for which to generate the schema | ||
-h, --help display help for command | ||
``` | ||
### Generate schema | ||
```bash | ||
reso-certification-utils schema -g -m <path to metadata json file> -o <path to output directory> | ||
``` | ||
Additional options: | ||
- `-a` or `--additionalProperties`: Add this flag to allow additional properties. | ||
- `-r` or `--resource`: Option to specify the resource. Defaults to `property`. | ||
### Validate payload | ||
```bash | ||
reso-certification-utils schema -v -p <path to payloads json file> -s <path to the schema json file> | ||
``` | ||
AJV errors could be large depending on how many errors are found. To save the errors in a file we can pass the directory where we want to save the errors file with `-e <path to error directory>`. |