@@ -672,6 +672,12 @@ def is_subtype(existing: PropType, new: PropType) -> bool:
672
672
return True
673
673
if isinstance (existing , list ) and (new in existing ):
674
674
return True
675
+ if existing == "Any" :
676
+ if new is None or new == [] or new == ["null" ] or new == "null" :
677
+ return False
678
+ if isinstance (new , list ) and "null" in new :
679
+ return False
680
+ return True
675
681
if (
676
682
isinstance (existing , dict )
677
683
and "type" in existing
@@ -681,6 +687,33 @@ def is_subtype(existing: PropType, new: PropType) -> bool:
681
687
and new ["type" ] == "array"
682
688
):
683
689
return is_subtype (existing ["items" ], new ["items" ])
690
+ if (
691
+ isinstance (existing , dict )
692
+ and "type" in existing
693
+ and existing ["type" ] == "enum"
694
+ and isinstance (new , dict )
695
+ and "type" in new
696
+ and new ["type" ] == "enum"
697
+ ):
698
+ return is_subtype (existing ["symbols" ], new ["symbols" ])
699
+ if (
700
+ isinstance (existing , dict )
701
+ and "type" in existing
702
+ and existing ["type" ] == "record"
703
+ and isinstance (new , dict )
704
+ and "type" in new
705
+ and new ["type" ] == "record"
706
+ ):
707
+ for new_field in cast (List [Dict [str , Any ]], new ["fields" ]):
708
+ new_field_missing = True
709
+ for existing_field in cast (List [Dict [str , Any ]], existing ["fields" ]):
710
+ if new_field ["name" ] == existing_field ["name" ]:
711
+ if not is_subtype (existing_field ["type" ], new_field ["type" ]):
712
+ return False
713
+ new_field_missing = False
714
+ if new_field_missing :
715
+ return False
716
+ return True
684
717
if isinstance (existing , list ) and isinstance (new , list ):
685
718
missing = False
686
719
for _type in new :
0 commit comments