diff --git a/proto3-suite.cabal b/proto3-suite.cabal index 986f92cc..3e750c37 100644 --- a/proto3-suite.cabal +++ b/proto3-suite.cabal @@ -103,6 +103,7 @@ library build-depends: aeson >= 1.1.1.0 && < 2.2, aeson-pretty, attoparsec >= 0.13.0.1, + attoparsec-aeson >= 2.2.0.0 , base >=4.15 && <5.0, base64-bytestring >= 1.0.0.1 && < 1.3, binary >=0.8.3, @@ -192,8 +193,9 @@ test-suite tests Test.Proto.Parse.Option build-depends: - aeson >= 1.1.1.0 && < 2.2 + aeson >= 1.1.1.0 , attoparsec >= 0.13.0.1 + , attoparsec-aeson , base >=4.15 && <5.0 , base64-bytestring >= 1.0.0.1 && < 1.3 , bytestring >=0.10.6.0 && <0.13 diff --git a/src/Proto3/Suite/JSONPB/Class.hs b/src/Proto3/Suite/JSONPB/Class.hs index 89d3ec67..1672344b 100644 --- a/src/Proto3/Suite/JSONPB/Class.hs +++ b/src/Proto3/Suite/JSONPB/Class.hs @@ -588,11 +588,23 @@ instance A.ToJSONKey (Proto3.Suite.Types.String TS.ShortText) where #endif instance (A.ToJSONKey k, ToJSONPB k, ToJSONPB v) => ToJSONPB (M.Map k v) where - toJSONPB m opts = A.liftToJSON @(M.Map k) (`toJSONPB` opts) (A.Array . V.fromList . map (`toJSONPB` opts)) m - toEncodingPB m opts = A.liftToEncoding @(M.Map k) (`toEncodingPB` opts) (E.list (`toEncodingPB` opts)) m + toJSONPB m opts = A.liftToJSON @(M.Map k) +#if MIN_VERSION_aeson(2,2,0) + (const False) -- Unless and until we test for the protobuf default value. +#endif + (`toJSONPB` opts) (A.Array . V.fromList . map (`toJSONPB` opts)) m + toEncodingPB m opts = A.liftToEncoding @(M.Map k) +#if MIN_VERSION_aeson(2,2,0) + (const False) -- Unless and until we test for the protobuf default value. +#endif + (`toEncodingPB` opts) (E.list (`toEncodingPB` opts)) m instance (Ord k, A.FromJSONKey k, FromJSONPB k, FromJSONPB v) => FromJSONPB (M.Map k v) where - parseJSONPB = A.liftParseJSON @(M.Map k) parseJSONPB parseList + parseJSONPB = A.liftParseJSON @(M.Map k) +#if MIN_VERSION_aeson(2,2,0) + Nothing -- Unless and until we decide to use the protobuf default value. +#endif + parseJSONPB parseList where parseList (A.Array a) = traverse parseJSONPB (V.toList a) parseList v = A.typeMismatch "not a list" v diff --git a/stack.yaml b/stack.yaml index fbc4ab86..42cfc9b9 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,5 +1,4 @@ -resolver: - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml +resolver: nightly-2025-01-16 allow-newer: true @@ -8,7 +7,7 @@ packages: extra-deps: - github: awakesecurity/proto3-wire - commit: 9b1c178f8a23a5f03237cb77cce403bc386da523 + commit: 6fdf0eb93b2028ade0e3e011ce8429c94546839e nix: packages: diff --git a/stack.yaml.lock b/stack.yaml.lock index 8544acb7..e712e9cd 100644 --- a/stack.yaml.lock +++ b/stack.yaml.lock @@ -5,20 +5,19 @@ packages: - completed: - size: 45006 - url: https://github.com/awakesecurity/proto3-wire/archive/9b1c178f8a23a5f03237cb77cce403bc386da523.tar.gz name: proto3-wire - version: 1.2.2 - sha256: df812fdfe6c7df641d310c6273c16de4fda8f4d61635f084e24937ca0b91944c pantry-tree: - size: 1325 - sha256: bf3471cb92d5c273bf1163594380e836b48917a076b08827286a32f3d2320dee + sha256: 2a9f52ebbba545c86af905dd0e0aa18435cce9b1fa662765b91c6c71fc3c2fea + size: 2524 + sha256: 1d9853d782a57b71f007450fb73007ab9c79bb5057abb56c20b9bd261f598fe2 + size: 53571 + url: https://github.com/awakesecurity/proto3-wire/archive/6fdf0eb93b2028ade0e3e011ce8429c94546839e.tar.gz + version: 1.4.4 original: - url: https://github.com/awakesecurity/proto3-wire/archive/9b1c178f8a23a5f03237cb77cce403bc386da523.tar.gz + url: https://github.com/awakesecurity/proto3-wire/archive/6fdf0eb93b2028ade0e3e011ce8429c94546839e.tar.gz snapshots: - completed: - size: 585393 - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml - sha256: c632012da648385b9fa3c29f4e0afd56ead299f1c5528ee789058be410e883c0 - original: - url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/0.yaml + sha256: 4a200d54cdf4e8af189ffe64c0618cba44f1a2b9d42ed88b62d575ab93a041ea + size: 629580 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2025/1/16.yaml + original: nightly-2025-01-16