Skip to content

Commit

Permalink
Add exclude option
Browse files Browse the repository at this point in the history
Marcisbee committed Nov 13, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f264741 commit 0f6319c
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ Options:
-v, --version print version and exit
-s, --schema validate json according to schema
-i, --include array of file paths to include (default: *.json)
-e, --exclude array of file paths to exclude (default: node_modules/**)
-a, --allow rules for definitions and keys to allow (example: additionalProperties:name:MyDefinition)
```

5 changes: 5 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -58,6 +58,10 @@ function validator() {
userConfig.include = args["--include"];
}

if (args["--exclude"]) {
userConfig.exclude = args["--exclude"];
}

if (args["--allow"]) {
userConfig.allow = args["--allow"].reduce(
(acc, rule) => {
@@ -160,6 +164,7 @@ function validator() {
},
{
include: config.include,
exclude: config.exclude,
},
);
} catch (_) {

0 comments on commit 0f6319c

Please sign in to comment.