@@ -565,8 +565,8 @@ areSchemasDisjoint qualify schemas =
565565 CliMonad . withWarning
566566 ( CliMonad . succeed False )
567567 )
568- ( subSchemaToProperties qualify lo )
569- ( subSchemaToProperties qualify ro )
568+ ( schemaToProperties qualify l )
569+ ( schemaToProperties qualify r )
570570
571571 go :
572572 Json . Schema . Definitions . Schema
@@ -607,10 +607,10 @@ areTypesDisjoint : Common.Type -> Common.Type -> ( Bool, List String )
607607areTypesDisjoint ltype rtype =
608608 case ( ltype, rtype ) of
609609 ( Common . Ref _, _ ) ->
610- ( False , [ " disjoin check for ref types not implemented yet" ] )
610+ ( False , [ " Disjoin check for ref types not implemented yet" ] )
611611
612612 ( _, Common . Ref _ ) ->
613- ( False , [ " disjoin check for ref types not implemented yet" ] )
613+ ( False , [ " Disjoin check for ref types not implemented yet" ] )
614614
615615 ( Common . Value , _ ) ->
616616 ( False , [] )
@@ -627,6 +627,12 @@ areTypesDisjoint ltype rtype =
627627 ( Common . Nullable _, Common . Null ) ->
628628 ( False , [] )
629629
630+ ( Common . Nullable c, Common . Basic _ _ ) ->
631+ areTypesDisjoint c rtype
632+
633+ ( Common . Basic _ _, Common . Nullable c ) ->
634+ areTypesDisjoint ltype c
635+
630636 ( Common . Null , Common . Null ) ->
631637 ( False , [] )
632638
@@ -681,8 +687,40 @@ areTypesDisjoint ltype rtype =
681687 _ ->
682688 ( True , [] )
683689
690+ ( Common . Object lfields, Common . Object rfields ) ->
691+ let
692+ ldict : FastDict . Dict String Common . Field
693+ ldict =
694+ lfields
695+ |> List . map ( \ ( k, v ) -> ( Common . unwrapUnsafe k, v ))
696+ |> FastDict . fromList
697+
698+ rdict : FastDict . Dict String Common . Field
699+ rdict =
700+ rfields
701+ |> List . map ( \ ( k, v ) -> ( Common . unwrapUnsafe k, v ))
702+ |> FastDict . fromList
703+ in
704+ FastDict . merge
705+ ( \ _ _ acc -> acc)
706+ ( \ _ lfield rfield ( acc, warns ) ->
707+ if acc || ( not lfield. required && not rfield. required) then
708+ ( acc, warns )
709+
710+ else
711+ let
712+ ( nacc, nwarns ) =
713+ areTypesDisjoint lfield. type_ rfield. type_
714+ in
715+ ( nacc, warns ++ nwarns )
716+ )
717+ ( \ _ _ acc -> acc)
718+ ldict
719+ rdict
720+ ( False , [] )
721+
684722 _ ->
685- ( False , [ " disjoin check not implemented for types " ++ typeToString ltype ++ " and " ++ typeToString rtype ] )
723+ ( False , [ " Disjoin check not implemented for types " ++ typeToString ltype ++ " and " ++ typeToString rtype ] )
686724
687725
688726typeToString : Common .Type -> String
0 commit comments