packages feed

deriving-aeson 0.2.3 → 0.2.4

raw patch · 3 files changed

+15/−3 lines, 3 filesdep ~aesonPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson

API changes (from Hackage documentation)

+ Deriving.Aeson: data RejectUnknownFields
+ Deriving.Aeson: instance Deriving.Aeson.AesonOptions xs => Deriving.Aeson.AesonOptions (Deriving.Aeson.RejectUnknownFields : xs)

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for deriving-aeson +## 0.2.4++* Added `RejectUnknownFields`+ ## 0.2.3  * Fixed a bug in `SumTaggedObject`
deriving-aeson.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.4 name:                deriving-aeson-version:             0.2.3+version:             0.2.4 synopsis:            Type driven generic aeson instance customisation description:         This package provides a newtype wrapper with   FromJSON/ToJSON instances customisable via a phantom type parameter.@@ -13,7 +13,7 @@ copyright:           Copyright (c) 2020 Fumiaki Kinoshita category:            JSON, Generics extra-source-files:  CHANGELOG.md, README.md-tested-with:         GHC == 8.6.5, GHC == 8.8.3+tested-with:         GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.1  source-repository head   type: git@@ -23,7 +23,7 @@   exposed-modules:     Deriving.Aeson     Deriving.Aeson.Stock-  build-depends:       base >= 4.12 && <5, aeson >= 1.3 && <1.5+  build-depends:       base >= 4.12 && <5, aeson >= 1.4.7.0 && <1.5   hs-source-dirs: src   default-language:    Haskell2010   ghc-options: -Wall -Wcompat
src/Deriving/Aeson.hs view
@@ -15,6 +15,7 @@   , FieldLabelModifier   , ConstructorTagModifier   , OmitNothingFields+  , RejectUnknownFields   , TagSingleConstructors   , NoAllNullaryToStringTag   , UnwrapUnaryRecords@@ -37,6 +38,7 @@   )where  import Data.Aeson+import Data.Aeson.Types import Data.Coerce import Data.List (stripPrefix) import Data.Maybe (fromMaybe)@@ -66,6 +68,9 @@ -- | Record fields with a Nothing value will be omitted from the resulting object. data OmitNothingFields +-- | JSON Documents mapped to records with unmatched keys will be rejected+data RejectUnknownFields+ -- | Encode types with a single constructor as sums, so that allNullaryToStringTag and sumEncoding apply. data TagSingleConstructors @@ -125,6 +130,9 @@  instance AesonOptions xs => AesonOptions (OmitNothingFields ': xs) where   aesonOptions = (aesonOptions @xs) { omitNothingFields = True }++instance AesonOptions xs => AesonOptions (RejectUnknownFields ': xs) where+  aesonOptions = (aesonOptions @xs) { rejectUnknownFields = True }  instance (StringModifier f, AesonOptions xs) => AesonOptions (FieldLabelModifier f ': xs) where   aesonOptions = (aesonOptions @xs) { fieldLabelModifier = getStringModifier @f }