From 6b98e6c835301ad2a483965b3702b19da66f6165 Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 6 Feb 2022 15:30:43 +0200 Subject: [PATCH 1/2] Update haskell-http-client generator to Aeson 2.x --- .../src/main/resources/haskell-http-client/Core.mustache | 4 ++-- .../haskell-http-client/haskell-http-client.cabal.mustache | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache index 96fb0c22c116..ddd07b719218 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache @@ -70,7 +70,7 @@ data {{configType}} = {{configType}} , configLogContext :: LogContext -- ^ Configures the logger , configAuthMethods :: [AnyAuthMethod] -- ^ List of configured auth methods , configValidateAuthMethods :: Bool -- ^ throw exceptions if auth methods are not configured - , configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':' + , configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':' } -- | display the config @@ -419,7 +419,7 @@ _applyAuthMethods req config@({{configType}} {configAuthMethods = as}) = -- * Utils -- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON) -_omitNulls :: [(Text, A.Value)] -> A.Value +_omitNulls :: [(A.Key, A.Value)] -> A.Value _omitNulls = A.object . P.filter notNull where notNull (_, A.Null) = False diff --git a/modules/openapi-generator/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache b/modules/openapi-generator/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache index ebc4c30243f7..c5b3d8c19a24 100644 --- a/modules/openapi-generator/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache +++ b/modules/openapi-generator/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache @@ -39,7 +39,7 @@ library lib ghc-options: -Wall -funbox-strict-fields build-depends: - aeson >=1.0 && <2.0 + aeson >=2.0 && <3.0 , base >=4.7 && <5.0 , base64-bytestring >1.0 && <2.0 , bytestring >=0.10.0 From 3e594a38c9765c8c93b9e62584f400d4ab65ff2b Mon Sep 17 00:00:00 2001 From: Andrea Cognolato Date: Sun, 6 Feb 2022 16:10:03 +0200 Subject: [PATCH 2/2] Update samples --- .../petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs | 4 ++-- .../petstore/haskell-http-client/openapi-petstore.cabal | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs index 855d83ce97be..3a30cf046e96 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs @@ -79,7 +79,7 @@ data OpenAPIPetstoreConfig = OpenAPIPetstoreConfig , configLogContext :: LogContext -- ^ Configures the logger , configAuthMethods :: [AnyAuthMethod] -- ^ List of configured auth methods , configValidateAuthMethods :: Bool -- ^ throw exceptions if auth methods are not configured - , configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':' + , configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':' } -- | display the config @@ -428,7 +428,7 @@ _applyAuthMethods req config@(OpenAPIPetstoreConfig {configAuthMethods = as}) = -- * Utils -- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON) -_omitNulls :: [(Text, A.Value)] -> A.Value +_omitNulls :: [(A.Key, A.Value)] -> A.Value _omitNulls = A.object . P.filter notNull where notNull (_, A.Null) = False diff --git a/samples/client/petstore/haskell-http-client/openapi-petstore.cabal b/samples/client/petstore/haskell-http-client/openapi-petstore.cabal index 0ce64e3eba48..8955fd7aed19 100644 --- a/samples/client/petstore/haskell-http-client/openapi-petstore.cabal +++ b/samples/client/petstore/haskell-http-client/openapi-petstore.cabal @@ -35,7 +35,7 @@ library lib ghc-options: -Wall -funbox-strict-fields build-depends: - aeson >=1.0 && <2.0 + aeson >=2.0 && <3.0 , base >=4.7 && <5.0 , base64-bytestring >1.0 && <2.0 , bytestring >=0.10.0