Skip to content

Commit

Permalink
fix(index.js): -x flag is not working properly for the suppression case
Browse files Browse the repository at this point in the history
When passing `-x -` on the command line, a schema is still created in the process' cwd.
This is because the `-x` value of `-` is coerced to an empty string.
Later on, it is tested against '-' instead of empty string.

Fixes #203
  • Loading branch information
gekim authored Jan 15, 2020
1 parent 50e2d4d commit d929d9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function main(args) {
.alias('x', 'schema-out')
.describe('x', 'output JSON Schema files including description and validated examples in the specified folder, or suppress with -')
.default('x', nodepath.resolve(nodepath.join('.', 'out')))
.coerce('x', x => (x === '-' ? '' : nodepath.resolve(x)))
.coerce('x', x => (x === '-' ? '-' : nodepath.resolve(x)))

.alias('e', 'schema-extension')
.describe('e', 'JSON Schema file extension eg. schema.json or json')
Expand Down

0 comments on commit d929d9b

Please sign in to comment.