Skip to content
Snippets Groups Projects
Commit bba7ce28 authored by Ken Brooks's avatar Ken Brooks
Browse files

updating printed help and README

parent d0cc7150
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
[![CI](https://github.com/neilpa/yajsv/workflows/CI/badge.svg)](https://github.com/neilpa/yajsv/actions/)
Yet Another [JSON-Schema](https://json-schema.org) Validator. Command line tool for validating JSON documents against provided schemas.
Yet Another [JSON-Schema](https://json-schema.org) Validator. Command line tool for validating JSON and YAML documents against provided schemas.
The real credit goes to [xeipuuv/gojsonschema](https://github.com/xeipuuv/gojsonschema) which does the heavy lifting behind this CLI.
......@@ -18,21 +18,34 @@ There are also pre-built static binaries for Windows, Mac and Linux on the [rele
## Usage
yajsv validates JSON documents against a schema, providing a status per document:
yajsv validates JSON and YAML documents against a schema, providing a status per document:
* pass: Document is valid relative to the schema
* fail: Document is invalid relative to the schema
* error: Document is malformed, e.g. not valid JSON
* error: Document is malformed, e.g. not valid JSON or YAML
The 'fail' status may be reported multiple times per-document, once for each schema validation failure.
Basic usage
Any combination can be used for schema and document. For example you can use a JSON schema to validate a YAML document.
Basic usage example
```
$ yajsv -s schema.json document.json
document.json: pass
```
Basic usage example with YAML schema and document:
```
$ yajsv -s schema.yml document.yml
document.yml: pass
```
With multiple schema files and docs
```
......
......@@ -190,14 +190,14 @@ func jsonLoader(path string) (gojsonschema.JSONLoader, error) {
}
func printUsage() {
fmt.Fprintf(os.Stderr, `Usage: %s -s schema.json [options] document.json ...
fmt.Fprintf(os.Stderr, `Usage: %s -s schema.json|schema.yml [options] document.json|document.yml ...
yajsv validates JSON document(s) against a schema. One of three statuses are
yajsv validates JSON and YAML document(s) against a schema. One of three statuses are
reported per document:
pass: Document is valid relative to the schema
fail: Document is invalid relative to the schema
error: Document is malformed, e.g. not valid JSON
error: Document is malformed, e.g. not valid JSON or YAML
The 'fail' status may be reported multiple times per-document, once for each
schema validation failure.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment