@@ -123,6 +123,10 @@ def _validate_wildcard_patterns(self) -> None:
123123 )
124124 self .applied_keys .add (data_key )
125125
126+ if "." in data_key :
127+ parent_key = data_key .split ("." )[0 ]
128+ self .applied_keys .add (parent_key )
129+
126130 def _validate_catch_all (self ) -> None :
127131 """Validate remaining keys with catch-all wildcard '*'."""
128132 if "*" in self .schema :
@@ -356,6 +360,7 @@ def _validate_mixed_type_element(
356360 ) -> None :
357361 """Validate an element against multiple allowed types."""
358362 valid_type_found = False
363+ nested_errors_found = False
359364 sorted_types = sorted (
360365 allowed_types , key = lambda t : t == bool , reverse = True
361366 )
@@ -375,24 +380,33 @@ def _validate_mixed_type_element(
375380 break
376381 continue
377382
383+ # For complex types (like dicts), validate and propagate specific errors
378384 temp_errors = {}
379385 temp_validator = DataValidator (
380- { key_path : element_value },
381- { key_path : allowed_type },
386+ element_value , # Use the element value directly as data
387+ allowed_type , # Use the allowed type directly as schema
382388 temp_errors ,
383389 )
384- temp_validator .validate_data_value (
385- key_path , element_value , allowed_type
386- )
390+ temp_validator .validate ()
387391
388392 if not temp_errors :
389393 valid_type_found = True
390394 break
395+ else :
396+ # If there are specific validation errors, add them directly
397+ # to our main errors dict with their precise key paths
398+ for error_key , error_code in temp_errors .items ():
399+ # Prepend the array element path to create full key path
400+ full_error_key = f"{ key_path } .{ error_key } "
401+ self .errors [full_error_key ] = error_code
402+ nested_errors_found = True
403+ # Don't break here - continue trying other allowed types
391404
392405 except Exception :
393406 continue
394407
395- if not valid_type_found :
408+ # Only add generic error if no valid type was found AND no specific nested errors were found
409+ if not valid_type_found and not nested_errors_found :
396410 self .errors [key_path ] = ValidationErrorCode .INVALID_ARRAY_ELEMENT
397411
398412 def _validate_tuple_types (
0 commit comments