@@ -529,7 +529,7 @@ processSchema (Traced t Schema{..}) = do
529 TopFormula -> All True
529 TopFormula -> All True
530 _ -> All False
530 _ -> All False
531 -- remove optional fields whose schemata match that of additional props
531 -- remove optional fields whose schemata match that of additional props
532− propMap = M.filter (\p -> propRequired p || not (propFormula p /= addProps)) $ M.fromList propList
532+ propMap = M.filter (\p -> propRequired p || propFormula p /= addProps) $ M.fromList propList
533 propertiesClause
533 propertiesClause
534 | any (\p -> propRequired p && allBottom (propFormula p)) propMap
534 | any (\p -> propRequired p && allBottom (propFormula p)) propMap
535 = bottom -- if any required field has unsatisfiable schema
535 = bottom -- if any required field has unsatisfiable schema
@@ -609,15 +609,18 @@ checkFormulas env tr (ProdCons (fp, ep) (fc, ec)) =
609 -- shortcut of \/_j A[j] ⊂ ∅ hardly helps.
609 -- shortcut of \/_j A[j] ⊂ ∅ hardly helps.
610 forType_ $ \ty ->
610 forType_ $ \ty ->
611 case (ty fp, ty fc) of
611 case (ty fp, ty fc) of
612− (DNF pss, BottomFormula) -> F.for_ pss $ \(Conjunct ps) -> checkContradiction ps
612+ (DNF pss, BottomFormula) -> F.for_ pss $ \(Conjunct ps) -> checkContradiction tr ps
613 (DNF pss, SingleConjunct cs) -> F.for_ pss $ \(Conjunct ps) -> do
613 (DNF pss, SingleConjunct cs) -> F.for_ pss $ \(Conjunct ps) -> do
614 F.for_ cs $ checkImplication env ps -- avoid disjuntion if there's only one conjunct
614 F.for_ cs $ checkImplication env ps -- avoid disjuntion if there's only one conjunct
615 (DNF pss, DNF css) -> F.for_ pss $ \(Conjunct ps) -> do
615 (DNF pss, DNF css) -> F.for_ pss $ \(Conjunct ps) -> do
616 anyOfM tr (SubtreeCheckIssue $ NoMatchingCondition $ SomeCondition . getTraced <$> ps)
616 anyOfM tr (SubtreeCheckIssue $ NoMatchingCondition $ SomeCondition . getTraced <$> ps)
617 [F.for_ cs $ checkImplication env ps | Conjunct cs <- S.toList css]
617 [F.for_ cs $ checkImplication env ps | Conjunct cs <- S.toList css]
620+ :: Trace OpenApi Schema
619−checkContradiction :: [Traced OpenApi (Condition t)] -> CompatFormula s ()
621+ -> [Traced OpenApi (Condition t)]
622+ -> CompatFormula s ()
620−checkContradiction _ = pure () -- TODO
623+checkContradiction tr _ = issueAtTrace tr NoContradiction -- TODO
622checkImplication
625checkImplication
623 :: (HasAll (CheckEnv Schema) xs, Typeable t)
626 :: (HasAll (CheckEnv Schema) xs, Typeable t)
@@ -759,6 +762,7 @@ instance Subtree Schema where
759 = NotSupported Text
762 = NotSupported Text
760 | InvalidSchema Text
763 | InvalidSchema Text
761 | NoMatchingCondition [SomeCondition]
764 | NoMatchingCondition [SomeCondition]
762 deriving stock (Eq, Ord, Show)
766 deriving stock (Eq, Ord, Show)
763 type CheckEnv Schema = '[ProdCons (Definitions Schema)]
767 type CheckEnv Schema = '[ProdCons (Definitions Schema)]
764 checkCompatibility env schs = withTrace $ \traces -> do
768 checkCompatibility env schs = withTrace $ \traces -> do