git.iko.soy/typeable/minio-hs
on master help sign in
Support aeson 2 (#169)
commitbaee20dfb641606ecb0e666a430ee2bd828f8d61 authorTom McLaughlin <pyro777@gmail.com> dateTue 24 May 2022, 15:34 (4 years ago) parentbdac380
4 files changed+20−6
minio-hs.cabal+1−1 src/Network/Minio/PresignedOperations.hs+14 stack.yaml+1−1 stack.yaml.lock+4−4
minio-hs.cabal+1−1
@@ -92,7 +92,7 @@ common base-settings
9292
9393 build-depends: base >= 4.7 && < 5
9494 , relude >= 0.7 && < 2
95− , aeson >= 1.2 && < 2
95+ , aeson >= 1.2 && < 3
9696 , base64-bytestring >= 1.0
9797 , binary >= 0.8.5.0
9898 , bytestring >= 0.10
src/Network/Minio/PresignedOperations.hs+14
@@ -1,3 +1,5 @@
1+{-# LANGUAGE CPP #-}
2+
13--
24-- MinIO Haskell SDK, (C) 2017 MinIO, Inc.
35--
@@ -51,6 +53,10 @@ import Network.Minio.Errors
5153import Network.Minio.Sign.V4
5254import Network.URI (uriToString)
5355
56+#if MIN_VERSION_aeson(2,0,0)
57+import qualified Data.Aeson.Key as A
58+#endif
59+
5460-- | Generate a presigned URL. This function allows for advanced usage
5561-- - for simple cases prefer the `presigned*Url` functions.
5662--
@@ -174,12 +180,20 @@ data PostPolicyCondition
174180
175181instance Json.ToJSON PostPolicyCondition where
176182 toJSON (PPCStartsWith k v) = Json.toJSON ["starts-with", k, v]
183+#if MIN_VERSION_aeson(2,0,0)
184+ toJSON (PPCEquals k v) = Json.object [(A.fromText k) .= v]
185+#else
177186 toJSON (PPCEquals k v) = Json.object [k .= v]
187+#endif
178188 toJSON (PPCRange k minVal maxVal) =
179189 Json.toJSON [Json.toJSON k, Json.toJSON minVal, Json.toJSON maxVal]
180190
181191 toEncoding (PPCStartsWith k v) = Json.foldable ["starts-with", k, v]
192+#if MIN_VERSION_aeson(2,0,0)
193+ toEncoding (PPCEquals k v) = Json.pairs ((A.fromText k) .= v)
194+#else
182195 toEncoding (PPCEquals k v) = Json.pairs (k .= v)
196+#endif
183197 toEncoding (PPCRange k minVal maxVal) =
184198 Json.foldable [Json.toJSON k, Json.toJSON minVal, Json.toJSON maxVal]
185199
stack.yaml+1−1
@@ -15,7 +15,7 @@
1515# resolver:
1616# name: custom-snapshot
1717# location: "./custom-snapshot.yaml"
18−resolver: lts-18.24
18+resolver: lts-19.7
1919
2020# User packages to be built.
2121# Various formats can be used as shown in the example below.
stack.yaml.lock+4−4
@@ -6,7 +6,7 @@
66packages: []
77snapshots:
88- completed:
9− size: 587821
10− url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/24.yaml
11− sha256: 06d844ba51e49907bd29cb58b4a5f86ee7587a4cd7e6cf395eeec16cba619ce8
12− original: lts-18.24
9+ size: 618884
10+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/7.yaml
11+ sha256: 57d4ce67cc097fea2058446927987bc1f7408890e3a6df0da74e5e318f051c20
12+ original: lts-19.7