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

Add draft 07 support (merge from original) #8

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.* eol=lf
2 changes: 2 additions & 0 deletions commands/ajv.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ var path = require('path');

module.exports = function (argv) {
var opts = options.get(argv);
opts.schemaId = 'auto';
if (argv.o) opts.sourceCode = true;
var ajv = new Ajv(opts);
var invalid;
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'));
addSchemas(argv.m, 'addMetaSchema', 'meta-schema');
addSchemas(argv.r, 'addSchema', 'schema');
customFormatsKeywords(argv.c);
Expand Down
2 changes: 1 addition & 1 deletion commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ parameters\n\
(file path should start with ".", otherwise used as require package)\n\
\n\
options:\n\
--errors= error reporting format ("js" by deafult)\n\
--errors= error reporting format ("js" by default)\n\
--changes= log changes in data after validation ("no" by default)\n\
js JavaScript object\n\
json JSON format\n\
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pajv",
"displayName": "Polyglottal JSON Schema Validator",
"version": "1.2.0",
"version": "2.0.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",
Expand Down Expand Up @@ -54,7 +54,8 @@
"url": "https://github.com/json-schema-everywhere/pajv"
},
"dependencies": {
"ajv": "^5.0.0",
"ajv": "^6.0.0",
"ajv-pack": "^0.3.0",
"any-json": "^3.0.0",
"deasync": "^0.1.10",
"deasync-promise": "^1.0.1",
Expand All @@ -64,7 +65,7 @@
"util.promisify": "^1.0.0"
},
"devDependencies": {
"ajv-keywords": "^2.0.0",
"ajv-keywords": "^3.0.0",
"coveralls": "^2.11.8",
"eslint": "^2.4.0",
"mocha": "^2.4.5",
Expand Down
4 changes: 2 additions & 2 deletions test/custom/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"id": "schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json",
"typeof": "number"
}
2 changes: 1 addition & 1 deletion test/meta/meta_schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/my_meta_schema#",
"title": "Core schema meta-schema",
"definitions": {
Expand Down
2 changes: 1 addition & 1 deletion test/schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "schema.json",
"description": "basic schema from z-schema benchmark (https://github.com/zaggino/z-schema)",
"title": "Product set",
Expand Down