Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
yajsv - Yet Another Json Schema Validator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
SmartDataLab
public
CI-CD tools
yajsv - Yet Another Json Schema Validator
Commits
bba7ce28
Commit
bba7ce28
authored
5 years ago
by
Ken Brooks
Browse files
Options
Downloads
Patches
Plain Diff
updating printed help and README
parent
d0cc7150
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+16
-3
16 additions, 3 deletions
README.md
main.go
+3
-3
3 additions, 3 deletions
main.go
with
19 additions
and
6 deletions
README.md
+
16
−
3
View file @
bba7ce28
...
...
@@ -2,7 +2,7 @@
[

](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
```
...
...
This diff is collapsed.
Click to expand it.
main.go
+
3
−
3
View file @
bba7ce28
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment