packages feed

aeson-schemas 1.4.2.1 → 1.4.3.0

raw patch · 15 files changed

+182/−111 lines, 15 filesdep −hintdep ~template-haskellPVP ok

version bump matches the API change (PVP)

Dependencies removed: hint

Dependency ranges changed: template-haskell

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# v1.4.3.0++* Drop support for GHC 9.4 + 9.6+* Add support for GHC 9.10 + 9.12+ # v1.4.2.1  * Fix benchmarks for GHC 9.8
README.md view
@@ -9,6 +9,8 @@ `aeson` for decoding nested JSON data that would be cumbersome to represent as Haskell ADTs. +Not related to [JSON Schema](https://json-schema.org/).+ ## Quickstart  ```haskell
aeson-schemas.cabal view
@@ -1,11 +1,11 @@ cabal-version: >= 1.10 --- This file has been generated from package.yaml by hpack version 0.36.0.+-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack  name:           aeson-schemas-version:        1.4.2.1+version:        1.4.3.0 synopsis:       Easily consume JSON data on-demand with type-safety description:    Parse JSON data easily and safely without defining new data types. Useful                 for deeply nested JSON data, which is difficult to parse using the default@@ -39,10 +39,9 @@     test/goldens/getqq_no_operators.golden     test/goldens/getqq_ops_after_list.golden     test/goldens/getqq_ops_after_tuple.golden-    test/goldens/ghc/9.4/getqq_missing_key.golden-    test/goldens/ghc/9.6/getqq_missing_key.golden+    test/goldens/ghc/9.10/getqq_missing_key.golden+    test/goldens/ghc/9.12/getqq_missing_key.golden     test/goldens/ghc/9.8/getqq_missing_key.golden-    test/goldens/ghc/9.9/getqq_missing_key.golden     test/goldens/README_Quickstart.golden     test/goldens/schemaqq_key_with_invalid_character.golden     test/goldens/schemaqq_key_with_trailing_escape.golden@@ -82,9 +81,9 @@       aeson <3     , base >=4.17 && <5     , first-class-families <0.9-    , hashable <1.5+    , hashable <1.6     , megaparsec <10-    , template-haskell <2.22+    , template-haskell <2.24     , text <2.2     , unordered-containers <0.3   default-language: Haskell2010@@ -125,7 +124,6 @@     , base     , deepseq     , filepath-    , hint     , interpolate     , process     , raw-strings-qq@@ -139,9 +137,6 @@     , th-orphans     , th-test-utils   default-language: Haskell2010-  if impl(ghc < 9.2)-    build-depends:-        hint <0.9.0.6  benchmark aeson-schemas-bench   type: exitcode-stdio-1.0
bench/Utils/DeepSeq.hs view
@@ -51,22 +51,14 @@ instance NFData TypeFamilyHead instance NFData TyLit instance NFData TySynEqn--#if MIN_VERSION_template_haskell(2,17,0) instance NFData Specificity-#endif--#if MIN_VERSION_template_haskell(2,17,0)-instance NFData flag => NFData (TyVarBndr flag)-#else-instance NFData TyVarBndr-#endif--#if MIN_VERSION_template_haskell(2,21,0)+instance (NFData flag) => NFData (TyVarBndr flag) instance NFData BndrVis-#endif- instance NFData Bytes++#if MIN_VERSION_template_haskell(2,22,0)+instance NFData NamespaceSpecifier+#endif  instance NFData (ForeignPtr a) where   rnf = rwhnf
src/Data/Aeson/Schema/TH/Utils.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-}@@ -197,10 +196,8 @@     AppT ty1 ty2 -> AppT (stripKinds ty1) (stripKinds ty2)     InfixT ty1 name ty2 -> InfixT (stripKinds ty1) name (stripKinds ty2)     UInfixT ty1 name ty2 -> UInfixT (stripKinds ty1) name (stripKinds ty2)-#if MIN_VERSION_template_haskell(2,19,0)     PromotedInfixT ty1 name ty2 -> PromotedInfixT (stripKinds ty1) name (stripKinds ty2)     PromotedUInfixT ty1 name ty2 -> PromotedUInfixT (stripKinds ty1) name (stripKinds ty2)-#endif     ParensT ty1 -> ParensT (stripKinds ty1)     ImplicitParamT str ty1 -> ImplicitParamT str (stripKinds ty1) @@ -212,9 +209,7 @@     UnboxedTupleT _ -> ty     UnboxedSumT _ -> ty     ArrowT -> ty-#if MIN_VERSION_template_haskell(2,17,0)     MulArrowT -> ty-#endif     EqualityT -> ty     ListT -> ty     PromotedTupleT _ -> ty
src/Data/Aeson/Schema/Utils/Compat.hs view
@@ -13,7 +13,10 @@   unions, ) where +#if !MIN_VERSION_base(4,20,0) import Data.List (foldl')+#endif+ import Data.Text (Text) import Prelude hiding (lookup) 
test/TestUtils.hs view
@@ -22,6 +22,7 @@   testGoldenIO,   testParseError,   ghcGoldenDir,+  ghcVersion, ) where  import Data.Aeson (FromJSON (..), Value, eitherDecode)@@ -34,6 +35,7 @@ import qualified Data.Text.Lazy as TextL import qualified Data.Text.Lazy.Encoding as TextL import Data.Typeable (Typeable, typeRep)+import Data.Version (Version, makeVersion, showVersion, versionBranch) import Language.Haskell.TH (ExpQ) import Language.Haskell.TH.Quote (QuasiQuoter (..)) import System.FilePath ((</>))@@ -111,11 +113,9 @@  -- | The directory to put GHC version-specific golden files. ghcGoldenDir :: FilePath-ghcGoldenDir = "ghc" </> ghcVersion+ghcGoldenDir = "ghc" </> showVersion ghcMinorVersion   where-    ghcVersion =-      Text.unpack-        . Text.intercalate "."-        . take 2-        . Text.splitOn "."-        $ __GLASGOW_HASKELL_FULL_VERSION__+    ghcMinorVersion = makeVersion . take 2 . versionBranch $ ghcVersion++ghcVersion :: Version+ghcVersion = makeVersion . map (read . Text.unpack) $ Text.splitOn "." __GLASGOW_HASKELL_FULL_VERSION__
test/TestUtils/DeepSeq.hs view
@@ -51,22 +51,14 @@ instance NFData TypeFamilyHead instance NFData TyLit instance NFData TySynEqn--#if MIN_VERSION_template_haskell(2,17,0) instance NFData Specificity-#endif--#if MIN_VERSION_template_haskell(2,17,0)-instance NFData flag => NFData (TyVarBndr flag)-#else-instance NFData TyVarBndr-#endif--#if MIN_VERSION_template_haskell(2,20,0) && __GLASGOW_HASKELL__ >= 907+instance (NFData flag) => NFData (TyVarBndr flag) instance NFData BndrVis-#endif- instance NFData Bytes++#if MIN_VERSION_template_haskell(2,22,0)+instance NFData NamespaceSpecifier+#endif  instance NFData (ForeignPtr a) where   rnf = rwhnf
test/Tests/GetQQ.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-}@@ -13,13 +12,15 @@ module Tests.GetQQ where  import Control.DeepSeq (deepseq)-import Control.Exception (SomeException, displayException, try)+import Control.Exception (SomeException, try) import Data.Aeson (FromJSON (..), ToJSON (..), withText) import Data.Aeson.QQ (aesonQQ) import Data.Text (Text) import qualified Data.Text as Text-import qualified Language.Haskell.Interpreter as Hint+import Data.Version (makeVersion)+import System.Exit (ExitCode (..)) import System.FilePath ((</>))+import System.Process (readProcessWithExitCode) import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.QuickCheck@@ -27,7 +28,7 @@ import Data.Aeson.Schema (Object, schema) import Data.Aeson.Schema.TH (mkEnum) import Data.Aeson.Schema.Utils.Sum (SumType (..))-import TestUtils (ghcGoldenDir, parseObject, testGoldenIO, testParseError)+import TestUtils (ghcGoldenDir, ghcVersion, parseObject, testGoldenIO, testParseError) import Tests.GetQQ.TH  mkEnum "Greeting" ["HELLO", "GOODBYE"]@@ -401,10 +402,24 @@     ]   where     testDir = "test/wont-compile/"-    getCompileError fp =-      Hint.runInterpreter (Hint.loadModules [fp]) >>= \case-        Left e -> pure $ displayException e-        Right _ -> error "Compilation unexpectedly succeeded"+    getCompileError fp = do+      let args =+            concat+              [ [fp]+              , -- https://gitlab.haskell.org/ghc/ghc/-/issues/25602+                if ghcVersion < makeVersion [9, 10]+                  then []+                  else ["-package", "ghc-internal"]+              ]+      (code, stdout, stderr) <- readProcessWithExitCode "ghc" args ""+      case code of+        ExitFailure _ -> pure stderr+        ExitSuccess ->+          error . unlines $+            [ "Unexpectedly succeeded:"+            , stdout+            , stderr+            ]  {- Helpers -} 
+ test/goldens/ghc/9.10/getqq_missing_key.golden view
@@ -0,0 +1,50 @@+test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]+    • Key 'missing' does not exist in the following schema:+      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",+           Data.Aeson.Schema.Type.SchemaScalar Bool)]+    • In the second argument of ‘(.)’, namely+        ‘Data.Aeson.Schema.Internal.getKey+           (GHC.Internal.Data.Proxy.Proxy ::+              GHC.Internal.Data.Proxy.Proxy "missing")’+      In the expression:+        (id+           . Data.Aeson.Schema.Internal.getKey+               (GHC.Internal.Data.Proxy.Proxy ::+                  GHC.Internal.Data.Proxy.Proxy "missing"))+          o+      In an equation for ‘result’:+          result+            = ((id+                  . Data.Aeson.Schema.Internal.getKey+                      (GHC.Internal.Data.Proxy.Proxy ::+                         GHC.Internal.Data.Proxy.Proxy "missing"))+                 o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^++test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]+    • Key 'missing' does not exist in the following schema:+      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",+           Data.Aeson.Schema.Type.SchemaScalar Bool)]+    • In the second argument of ‘(.)’, namely+        ‘Data.Aeson.Schema.Internal.getKey+           (GHC.Internal.Data.Proxy.Proxy ::+              GHC.Internal.Data.Proxy.Proxy "missing")’+      In the expression:+        (id+           . Data.Aeson.Schema.Internal.getKey+               (GHC.Internal.Data.Proxy.Proxy ::+                  GHC.Internal.Data.Proxy.Proxy "missing"))+          o+      In an equation for ‘result’:+          result+            = ((id+                  . Data.Aeson.Schema.Internal.getKey+                      (GHC.Internal.Data.Proxy.Proxy ::+                         GHC.Internal.Data.Proxy.Proxy "missing"))+                 o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^+
+ test/goldens/ghc/9.12/getqq_missing_key.golden view
@@ -0,0 +1,50 @@+test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]+    • Key 'missing' does not exist in the following schema:+      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",+           Data.Aeson.Schema.Type.SchemaScalar Bool)]+    • In the second argument of ‘(.)’, namely+        ‘Data.Aeson.Schema.Internal.getKey+           (GHC.Internal.Data.Proxy.Proxy ::+              GHC.Internal.Data.Proxy.Proxy "missing")’+      In the expression:+        (id+           . Data.Aeson.Schema.Internal.getKey+               (GHC.Internal.Data.Proxy.Proxy ::+                  GHC.Internal.Data.Proxy.Proxy "missing"))+          o+      In an equation for ‘result’:+          result+            = ((id+                  . Data.Aeson.Schema.Internal.getKey+                      (GHC.Internal.Data.Proxy.Proxy ::+                         GHC.Internal.Data.Proxy.Proxy "missing"))+                 o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^++test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]+    • Key 'missing' does not exist in the following schema:+      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",+           Data.Aeson.Schema.Type.SchemaScalar Bool)]+    • In the second argument of ‘(.)’, namely+        ‘Data.Aeson.Schema.Internal.getKey+           (GHC.Internal.Data.Proxy.Proxy ::+              GHC.Internal.Data.Proxy.Proxy "missing")’+      In the expression:+        (id+           . Data.Aeson.Schema.Internal.getKey+               (GHC.Internal.Data.Proxy.Proxy ::+                  GHC.Internal.Data.Proxy.Proxy "missing"))+          o+      In an equation for ‘result’:+          result+            = ((id+                  . Data.Aeson.Schema.Internal.getKey+                      (GHC.Internal.Data.Proxy.Proxy ::+                         GHC.Internal.Data.Proxy.Proxy "missing"))+                 o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^+
− test/goldens/ghc/9.4/getqq_missing_key.golden
@@ -1,18 +0,0 @@-test/wont-compile/GetMissingKey.hs:17:15: error:-    • Key 'missing' does not exist in the following schema:-      '[ '( 'Data.Aeson.Schema.Key.NormalKey "foo",-            'Data.Aeson.Schema.Type.SchemaScalar Bool)]-    • In the second argument of ‘(.)’, namely-        ‘Data.Aeson.Schema.Internal.getKey-           (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’-      In the expression:-        (id-           . Data.Aeson.Schema.Internal.getKey-               (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-          o-      In an equation for ‘result’:-          result-            = ((id-                  . Data.Aeson.Schema.Internal.getKey-                      (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-                 o)
− test/goldens/ghc/9.6/getqq_missing_key.golden
@@ -1,18 +0,0 @@-test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]-    • Key 'missing' does not exist in the following schema:-      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",-           Data.Aeson.Schema.Type.SchemaScalar Bool)]-    • In the second argument of ‘(.)’, namely-        ‘Data.Aeson.Schema.Internal.getKey-           (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’-      In the expression:-        (id-           . Data.Aeson.Schema.Internal.getKey-               (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-          o-      In an equation for ‘result’:-          result-            = ((id-                  . Data.Aeson.Schema.Internal.getKey-                      (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-                 o)
test/goldens/ghc/9.8/getqq_missing_key.golden view
@@ -1,3 +1,4 @@+ test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]     • Key 'missing' does not exist in the following schema:       '[ '(Data.Aeson.Schema.Key.NormalKey "foo",@@ -16,3 +17,28 @@                   . Data.Aeson.Schema.Internal.getKey                       (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))                  o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^++test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]+    • Key 'missing' does not exist in the following schema:+      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",+           Data.Aeson.Schema.Type.SchemaScalar Bool)]+    • In the second argument of ‘(.)’, namely+        ‘Data.Aeson.Schema.Internal.getKey+           (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’+      In the expression:+        (id+           . Data.Aeson.Schema.Internal.getKey+               (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))+          o+      In an equation for ‘result’:+          result+            = ((id+                  . Data.Aeson.Schema.Internal.getKey+                      (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))+                 o)+   |+17 | result = [get| o.missing |]+   |               ^^^^^^^^^^^^^
− test/goldens/ghc/9.9/getqq_missing_key.golden
@@ -1,18 +0,0 @@-test/wont-compile/GetMissingKey.hs:17:15: error: [GHC-64725]-    • Key 'missing' does not exist in the following schema:-      '[ '(Data.Aeson.Schema.Key.NormalKey "foo",-           Data.Aeson.Schema.Type.SchemaScalar Bool)]-    • In the second argument of ‘(.)’, namely-        ‘Data.Aeson.Schema.Internal.getKey-           (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing")’-      In the expression:-        (id-           . Data.Aeson.Schema.Internal.getKey-               (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-          o-      In an equation for ‘result’:-          result-            = ((id-                  . Data.Aeson.Schema.Internal.getKey-                      (Data.Proxy.Proxy :: Data.Proxy.Proxy "missing"))-                 o)