@@ -9,6 +9,7 @@ var locale = require('./locale.js').object;
99var split = require ( 'property-expr' ) . split ;
1010var Ref = require ( './util/reference' ) ;
1111var c = require ( 'case' ) ;
12+ var sortByFields = require ( './util/sortByFields' ) ;
1213
1314var _require = require ( './util/_' ) ;
1415
@@ -141,7 +142,7 @@ inherits(ObjectSchema, MixedSchema, {
141142 return value ;
142143 }
143144
144- var result = _this4 . _nodes . map ( function ( key ) {
145+ var validations = _this4 . _nodes . map ( function ( key ) {
145146 var path = ( opts . path ? opts . path + '.' : '' ) + key ,
146147 field = _this4 . fields [ key ] ,
147148 innerOptions = _extends ( { } , opts , { key : key , path : path , parent : value } ) ;
@@ -158,9 +159,12 @@ inherits(ObjectSchema, MixedSchema, {
158159 return true ;
159160 } ) ;
160161
161- result = endEarly ? Promise . all ( result ) . catch ( scopeError ( value ) ) : collectErrors ( result , value , opts . path , errors ) ;
162+ validations = endEarly ? Promise . all ( validations ) . catch ( scopeError ( value ) ) : collectErrors ( { validations : validations , value : value , errors : errors ,
163+ path : opts . path ,
164+ sort : sortByFields ( _this4 )
165+ } ) ;
162166
163- return result . then ( function ( ) {
167+ return validations . then ( function ( ) {
164168 return value ;
165169 } ) ;
166170 } ) ;
0 commit comments