Skip to content

Commit

Permalink
Support required value as function
Browse files Browse the repository at this point in the history
  • Loading branch information
alyyousuf7 committed Dec 15, 2016
1 parent b1d1e17 commit 048010c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/revalidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@
}

if (value === undefined) {
if (schema.required && schema.type !== 'any') {
var isRequired = schema.required;
if (typeof isRequired === 'function') {
isRequired = isRequired.bind(object)();
}

if (isRequired && schema.type !== 'any') {
return error('required', property, undefined, schema, errors);
} else {
return;
Expand Down

0 comments on commit 048010c

Please sign in to comment.