From e64d072d84b3907937e382d2678958be1685e23f Mon Sep 17 00:00:00 2001 From: Tom Sydney Kerckhove Date: Wed, 27 Oct 2021 12:32:29 +0200 Subject: [PATCH] got ci to pass --- .../src/Autodocodec/Aeson/Document.hs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/autodocodec-aeson/src/Autodocodec/Aeson/Document.hs b/autodocodec-aeson/src/Autodocodec/Aeson/Document.hs index e940417..bca4748 100644 --- a/autodocodec-aeson/src/Autodocodec/Aeson/Document.hs +++ b/autodocodec-aeson/src/Autodocodec/Aeson/Document.hs @@ -67,10 +67,9 @@ instance ToJSON JSONSchema where ObjectSchema os -> let combine (ps, rps) k (r, s) = ( (k, s) : ps, - ( case r of - Required -> k : rps - Optional -> rps - ) + case r of + Required -> k : rps + Optional -> rps ) in case M.foldlWithKey combine ([], []) os of ([], _) -> ["type" JSON..= ("object" :: Text)] @@ -110,10 +109,9 @@ instance FromJSON JSONSchema where let keySchemaFor k s = M.singleton k - ( ( if k `elem` requiredProps - then Required - else Optional - ), + ( if k `elem` requiredProps + then Required + else Optional, s ) pure $ ObjectSchema $ M.unions $ map (uncurry keySchemaFor) $ M.toList props @@ -158,8 +156,8 @@ jsonSchemaVia = go goObject :: ObjectCodec input output -> Map Text (KeyRequirement, JSONSchema) goObject = \case - RequiredKeyCodec k c -> M.singleton k (Required, (go c)) - OptionalKeyCodec k c -> M.singleton k (Optional, (go c)) + RequiredKeyCodec k c -> M.singleton k (Required, go c) + OptionalKeyCodec k c -> M.singleton k (Optional, go c) BimapObjectCodec _ _ oc -> goObject oc PureObjectCodec _ -> M.empty ApObjectCodec oc1 oc2 -> M.union (goObject oc1) (goObject oc2)