Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neilpa/yajsv
Yet Another JSON Schema Validator [CLI]
https://github.com/neilpa/yajsv
cli go golang json json-schema yaml
Last synced: about 2 months ago
JSON representation
Yet Another JSON Schema Validator [CLI]
- Host: GitHub
- URL: https://github.com/neilpa/yajsv
- Owner: neilpa
- License: mit
- Created: 2020-01-24T20:11:58.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-21T19:18:21.000Z (about 1 year ago)
- Last Synced: 2024-06-19T00:22:05.601Z (6 months ago)
- Topics: cli, go, golang, json, json-schema, yaml
- Language: Go
- Homepage: https://json-schema.org/
- Size: 56.6 KB
- Stars: 84
- Watchers: 4
- Forks: 11
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yajsv
[![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 and/or 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.
## Installation
Simply use `go install` to install
```
go install github.com/neilpa/yajsv
```There are also pre-built static binaries for Windows, Mac and Linux on the [releases tab](https://github.com/neilpa/yajsv/releases/latest).
## Usage
Yajsv validates JSON (and/or YAML) documents against a JSON-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 or YAMLThe 'fail' status may be reported multiple times per-document, once for each schema validation failure.
Basic usage example
```
$ yajsv -s schema.json document.json
document.json: pass
```Or with both schema and doc in YAML.
```
$ yajsv -s schema.yml document.yml
document.yml: pass
```With multiple schema files and docs
```
$ yajsv -s schema.json -r foo.json -r bar.yaml doc1.json doc2.yaml
doc1.json: pass
doc2.json: pass
```Or with file globs (note the quotes to side-step shell expansion)
```
$ yajsv -s main.schema.json -r '*.schema.json' 'docs/*.json'
docs/a.json: pass
docs/b.json: fail: Validation failure message
...
```Note that each referenced schema is assumed to be a path on the local filesystem. These are not
URI references to either local or external files.See `yajsv -h` for more details
## License
[MIT](/LICENSE)