Skip to content

Commit

Permalink
#40: added Readme file for schema validation tool
Browse files Browse the repository at this point in the history
  • Loading branch information
mohit-s96 committed Jul 27, 2023
1 parent 9bdf35a commit 8871f52
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions lib/schema/README.md
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>`.

0 comments on commit 8871f52

Please sign in to comment.