File tree 4 files changed +14
-6
lines changed
4 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -1247,7 +1247,7 @@ import { mixed, InferType } from 'yup';
1247
1247
let objectIdSchema = yup
1248
1248
.mixed ((input ): input is ObjectId => input instanceof ObjectId )
1249
1249
.transform ((value : any , input , ctx ) => {
1250
- if (ctx .typeCheck (value )) return value ;
1250
+ if (ctx .isType (value )) return value ;
1251
1251
return new ObjectId (value );
1252
1252
});
1253
1253
Original file line number Diff line number Diff line change @@ -316,7 +316,11 @@ export default class ObjectSchema<
316
316
}
317
317
318
318
return next . withMutation ( ( s : any ) =>
319
- s . setFields ( nextFields , this . _excludedEdges ) ,
319
+ // XXX: excludes here is wrong
320
+ s . setFields ( nextFields , [
321
+ ...this . _excludedEdges ,
322
+ ...schema . _excludedEdges ,
323
+ ] ) ,
320
324
) ;
321
325
}
322
326
Original file line number Diff line number Diff line change @@ -957,7 +957,7 @@ describe('Mixed Types ', () => {
957
957
foo : array ( number ( ) . integer ( ) ) . required ( ) ,
958
958
bar : string ( )
959
959
. max ( 2 )
960
- . default ( ( ) => 'a' )
960
+ . default ( ( ) => 'a' )
961
961
. meta ( { input : 'foo' } )
962
962
. label ( 'str!' )
963
963
. oneOf ( [ 'a' , 'b' ] )
@@ -966,7 +966,7 @@ describe('Mixed Types ', () => {
966
966
is : 'entered' ,
967
967
then : ( s ) => s . defined ( ) ,
968
968
} ) ,
969
- baz : tuple ( [ string ( ) , number ( ) ] )
969
+ baz : tuple ( [ string ( ) , number ( ) ] ) ,
970
970
} ) ;
971
971
} ) ;
972
972
@@ -1070,7 +1070,7 @@ describe('Mixed Types ', () => {
1070
1070
oneOf : [ ] ,
1071
1071
notOneOf : [ ] ,
1072
1072
tests : [ ] ,
1073
- }
1073
+ } ,
1074
1074
] ,
1075
1075
} ,
1076
1076
} ,
@@ -1182,7 +1182,7 @@ describe('Mixed Types ', () => {
1182
1182
oneOf : [ ] ,
1183
1183
notOneOf : [ ] ,
1184
1184
tests : [ ] ,
1185
- }
1185
+ } ,
1186
1186
] ,
1187
1187
} ,
1188
1188
} ,
Original file line number Diff line number Diff line change @@ -1005,6 +1005,10 @@ describe('Object types', () => {
1005
1005
await expect (
1006
1006
schema . concat ( object ( ) ) . isValid ( { a1 : null } ) ,
1007
1007
) . resolves . toEqual ( false ) ;
1008
+
1009
+ await expect (
1010
+ object ( ) . concat ( schema ) . isValid ( { a1 : null } ) ,
1011
+ ) . resolves . toEqual ( false ) ;
1008
1012
} ) ;
1009
1013
1010
1014
it ( 'should handle nested conditionals' , ( ) => {
You can’t perform that action at this time.
0 commit comments