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 Nov 27, 2016
1 parent b1d1e17 commit 23d9884
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/revalidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@
}

if (value === undefined) {
if (typeof schema.required === 'function') {
schema.required = schema.required.bind(object)();
}

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

0 comments on commit 23d9884

Please sign in to comment.