Skip to content

Commit

Permalink
fix: boolean schemas with strictKeywords option
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Aug 17, 2020
1 parent cf88d1d commit 7402f98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/dot/definitions.def
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@

{{## def.nonEmptySchema:_schema:
(it.opts.strictKeywords
? typeof _schema == 'object' && Object.keys(_schema).length > 0
? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
|| _schema === false
: it.util.schemaHasRules(_schema, it.RULES.all))
#}}

Expand Down
2 changes: 1 addition & 1 deletion lib/dot/validate.jst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
it.baseId = it.baseId || it.rootId;
delete it.isTop;

it.dataPathArr = [undefined];
it.dataPathArr = [""];

if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
var $defaultMsg = 'default is ignored in the schema root';
Expand Down
3 changes: 2 additions & 1 deletion spec/boolean.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe('boolean schemas', function() {
ajvs = [
new Ajv,
new Ajv({allErrors: true}),
new Ajv({inlineRefs: false})
new Ajv({inlineRefs: false}),
new Ajv({strictKeywords: true}),
];
});

Expand Down

0 comments on commit 7402f98

Please # to comment.