File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -395,9 +395,11 @@ def collect_validation(
395395 schema : Dict ,
396396 ) -> FieldValidation :
397397 # Validators in the main list data type are applied to the list overall.
398-
399398 validation = self ._constructor_validation (key , value )
400399
400+ if value is None and self .optional :
401+ return validation
402+
401403 if len (self ._children ) == 0 :
402404 return validation
403405
@@ -435,9 +437,11 @@ def collect_validation(
435437 schema : Dict ,
436438 ) -> FieldValidation :
437439 # Validators in the main object data type are applied to the object overall.
438-
439440 validation = self ._constructor_validation (key , value )
440441
442+ if value is None and self .optional :
443+ return validation
444+
441445 if len (self ._children ) == 0 :
442446 return validation
443447
You can’t perform that action at this time.
0 commit comments