Skip to content

Commit

Permalink
fix: duplicate "type" error is reported with coerceTypes option, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Apr 28, 2017
1 parent 92bfeda commit 4ed756e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/dot/validate.jst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
{{?}}
{{? $rulesGroup.type }}
}
{{? $typeSchema && $typeSchema === $rulesGroup.type }}
{{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }}
{{ var $typeChecked = true; }}
else {
{{
Expand All @@ -161,7 +161,7 @@
{{~}}
{{?}}

{{? $typeSchema && !$typeChecked && !(it.opts.coerceTypes && $coerceToTypes) }}
{{? $typeSchema && !$typeChecked && !$coerceToTypes }}
{{# def.checkType }}
{{# def.error:'type' }}
}
Expand Down
6 changes: 3 additions & 3 deletions spec/coercion.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,14 @@ describe('Type coercion', function () {
});


it.skip('should generate one error for type with coerceTypes option (issue #469)', function() {
it('should generate one error for type with coerceTypes option (issue #469)', function() {
var schema = {
"type": "number",
"minimum": 10
};

instances.forEach(function (ajv) {
var validate = ajv.compile(schema);
instances.forEach(function (_ajv) {
var validate = _ajv.compile(schema);
validate(9). should.equal(false);
validate.errors.length .should.equal(1);

Expand Down

0 comments on commit 4ed756e

Please sign in to comment.