Skip to content

Commit 86979b6

Browse files
committed
Validate properties from oneOf
1 parent 02e2358 commit 86979b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/validate.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ SOFTWARE.
2121
'use strict';
2222

2323
var ou = require('./objectUtils');
24+
var alternative = require('./alternative');
2425

2526
var checkNumber = function(schema, instance) {
2627
var errors = [];
@@ -173,6 +174,9 @@ validator.object = function(schema, instance, context) {
173174
if (instance == null)
174175
instance = {};
175176

177+
var alternativeSchema = alternative.schema(instance, schema, context);
178+
schema = alternativeSchema || schema;
179+
176180
if (instance.constructor !== Object)
177181
result.push({ path: [], errors: ['must be a plain object'] });
178182
else {

0 commit comments

Comments
 (0)