Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update any-json #2

Merged
merged 2 commits into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: node_js
before_script:
- npm install -g codeclimate-test-reporter
node_js:
- '4'
- '6'
- '7'
after_script:
Expand All @@ -21,4 +20,4 @@ deploy:
GZPWd1vS6FdbLG3usxZnImymG+AS0WdOY5NYz4DNW1UYhmJzOIilSbF0PGqjL0OzbtpeFvRPVEuqvu3LYI623YwsTDg4faycRXMo0OyVjS5vBq4CFF/JBTfkauxUZNq6cpMSg6f55sNshGuS4gGpnKBKkK6Bx8IkQRnEFJ44yfLWmyjPWmaGVEo5aXe6ZStdgLjvXNqL+uIcD57ssn8/nPsezZEAC+S3Kn9fYTqgyt21AaQQ7Hy/QW8JsYNikUlV/3xvueQftd8ILupm8PQ0SYhAgR35aIUbhDk8rEHmezFXGKOovNxDmqnZCAoZyP8WOn81Ey0Z14INZCz/qPBbPgjhhs7Q4O5Pq7SbwCEjqFUkQQ97yvUog28YwsRajl21tC20DXLxknWN06nKtu5EHnmGL9FGwUQt9mVumuJXF2NGHv8KS0EGMGMn9LSdCS89CtMrR/MhkRxCnjikHWxLIxIsDlklyQLY+6Lxc0cXAcLOULTDlOJFLlRCUU8FNxiHJkocFbw+oeVrn4ZzwAhdgAPmWGA+/fxx7cnxs4DSHaEZ3CnAC6rL5vEsKbA0IOjWDER0KbcVTU2OKm6+vZ1W3HP2fl4xbdENYTl78kk2ZXdTi4JtGoBeYX7nNuy+iDcYpLG4Jltna3L3UfvOblTSrXu8dEeTBZOYhryN6eQUi50=
email: vossad01@gmail.com
'on':
tags: true
tags: true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Polyglottal JSON Schema Validator (Polyglottal Ajv)

Command line interface for [ajv](https://github.com/epoberezkin/ajv) that utilizes [any-json](https://github.com/laktak/any-json/) to provide validation against many data formats. `pajv` can validate: **[CSON](https://github.com/bevry/cson), [Hjson](http://hjson.org/), [JSON](http://json.org/), [JSON5](http://json5.org/), and [YAML](http://yaml.org/)** files using JSON Schema. pajv is a fork of [ajv-cli](https://github.com/jessedc/ajv-cli).
Command line interface for [ajv](https://github.com/epoberezkin/ajv) that utilizes [any-json](https://github.com/laktak/any-json/) to provide validation against many data formats. `pajv` can validate: **[CSON](https://github.com/bevry/cson), [Hjson](http://hjson.org/), [JSON](http://json.org/), [JSON5](http://json5.org/), [TOML](https://github.com/toml-lang/toml), and [YAML](http://yaml.org/)** files using JSON Schema. pajv is a fork of [ajv-cli](https://github.com/jessedc/ajv-cli).

[![Build Status](https://travis-ci.org/json-schema-everywhere/pajv.svg?branch=master)](https://travis-ci.org/json-schema-everywhere/pajv)
[![npm version](https://badge.fury.io/js/pajv.svg)](https://www.npmjs.com/package/pajv)
Expand Down Expand Up @@ -43,7 +43,7 @@ pajv validate -s test/schema.json -d test/valid_data.json
pajv -s test/schema.json -d test/valid_data.json
```

You can omit `validate` command name and `.json` from the [input file names](https://nodejs.org/api/modules.html#modules_file_modules).
You can omit `validate` command name.


#### Parameters
Expand Down
10 changes: 5 additions & 5 deletions commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ options:\n\
function _helpValidate() {
console.log('\
Validate data file(s) against schema\n\
ajv [validate] -s schema_file -d data_file\n\
ajv [validate] -s schema_file -d "data*.ext"\n');
pajv [validate] -s schema_file -d data_file\n\
pajv [validate] -s schema_file -d "data*.ext"\n');
}

function helpTest() {
Expand Down Expand Up @@ -123,9 +123,9 @@ options:\n\
function _helpTest() {
console.log('\
Test data validation result\n\
ajv test -s schema_file -d data_file --valid\n\
ajv test -s schema_file -d data_file --invalid\n\
ajv test -s schema_file -d "data*.ext" --valid \n');
pajv test -s schema_file -d data_file --valid\n\
pajv test -s schema_file -d data_file --invalid\n\
pajv test -s schema_file -d "data*.ext" --valid \n');
}


Expand Down
4 changes: 3 additions & 1 deletion commands/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var anyjson = require('any-json');
var glob = require('glob');
var path = require('path');
var fs = require('fs');
var wait = require('deasync-promise');


module.exports = {
Expand Down Expand Up @@ -35,7 +36,8 @@ function openFile(filename, suffix){
var file = path.resolve(process.cwd(), filename);
try {
var contents = fs.readFileSync(file).toString();
return anyjson.convert(contents, path.extname(filename));
var format = path.extname(filename).substr(1).toLowerCase();
return wait(anyjson.decode(contents, format));
} catch(err) {
console.error('error: ' + err.message.replace(' module', ' ' + suffix));
process.exit(2);
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "pajv",
"displayName": "Polyglottal JSON Schema Validator",
"version": "1.0.1",
"description": " A command line JSON Schema validator that supports many file formats. Fork of jessedc/ajv-cli.",
"version": "1.1.0",
"description": "A command line JSON Schema validator that supports many file formats. Fork of jessedc/ajv-cli.",
"scripts": {
"eslint": "eslint index.js commands/*.js test/*.js test/**/*.js",
"test-spec": "mocha test/*.spec.js -R spec",
Expand Down Expand Up @@ -37,6 +37,7 @@
"hjson",
"ini",
"json5",
"toml",
"xml",
"yaml"
],
Expand All @@ -54,7 +55,9 @@
},
"dependencies": {
"ajv": "^5.0.0",
"any-json": "^2.2.0",
"any-json": "^3.0.0",
"deasync": "^0.1.10",
"deasync-promise": "^1.0.1",
"fast-json-patch": "^0.5.6",
"glob": "^7.0.3",
"minimist": "^1.2.0",
Expand Down