Skip to content

Commit baebf28

Browse files
committed
Fix Generics
1 parent 51fc584 commit baebf28

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Data/Aeson/Types/FromJSON.hs

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module Data.Aeson.Types.FromJSON
7979

8080
import Data.Aeson.Internal.Prelude
8181

82-
import Control.Monad (zipWithM)
82+
import Control.Monad (zipWithM, guard)
8383
import Data.Aeson.Internal.Functions (mapKey, mapKeyO)
8484
import Data.Aeson.Internal.Scientific
8585
import Data.Aeson.Types.Generic
@@ -1384,15 +1384,15 @@ instance {-# OVERLAPPABLE #-}
13841384

13851385
instance (Selector s, FromJSON a, Generic a, K1 i a ~ Rep a) =>
13861386
RecordFromJSON' arity (S1 s (K1 i a)) where
1387-
recordParseJSON' args obj =
1388-
recordParseJSONImpl (fmap K1 omittedField) gParseJSON args obj
1387+
recordParseJSON' args@(_ :* _ :* opts :* _) obj =
1388+
recordParseJSONImpl (fmap K1 $ guard (omitNothingFields opts) >> omittedField) gParseJSON args obj
13891389
{-# INLINE recordParseJSON' #-}
13901390

13911391
instance {-# OVERLAPPING #-}
13921392
(Selector s, FromJSON a) =>
13931393
RecordFromJSON' arity (S1 s (Rec0 a)) where
1394-
recordParseJSON' args obj =
1395-
recordParseJSONImpl (fmap K1 omittedField) gParseJSON args obj
1394+
recordParseJSON' args@(_ :* _ :* opts :* _) obj =
1395+
recordParseJSONImpl (fmap K1 $ guard (omitNothingFields opts) >> omittedField) gParseJSON args obj
13961396
{-# INLINE recordParseJSON' #-}
13971397

13981398
instance (Selector s, GFromJSON arity (Rec1 f), FromJSON1 f) =>

0 commit comments

Comments
 (0)