Skip to content

Commit 8511ce3

Browse files
[haskell-http-client] Update haskell-http-client generator to Aeson 2.x (#12309)
* Update haskell-http-client generator to Aeson 2.x Co-authored-by: Andrea Cognolato <[email protected]>
1 parent aac6ce2 commit 8511ce3

File tree

71 files changed

+7682
-6703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+7682
-6703
lines changed

modules/openapi-generator/src/main/resources/haskell-http-client/Core.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ data {{configType}} = {{configType}}
7070
, configLogContext :: LogContext -- ^ Configures the logger
7171
, configAuthMethods :: [AnyAuthMethod] -- ^ List of configured auth methods
7272
, configValidateAuthMethods :: Bool -- ^ throw exceptions if auth methods are not configured
73-
, configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':'
73+
, configQueryExtraUnreserved :: B.ByteString -- ^ Configures additional querystring characters which must not be URI encoded, e.g. '+' or ':'
7474
}
7575

7676
-- | display the config
@@ -419,7 +419,7 @@ _applyAuthMethods req config@({{configType}} {configAuthMethods = as}) =
419419
-- * Utils
420420

421421
-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
422-
_omitNulls :: [(Text, A.Value)] -> A.Value
422+
_omitNulls :: [(A.Key, A.Value)] -> A.Value
423423
_omitNulls = A.object . P.filter notNull
424424
where
425425
notNull (_, A.Null) = False

modules/openapi-generator/src/main/resources/haskell-http-client/haskell-http-client.cabal.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ library
3939
lib
4040
ghc-options: -Wall -funbox-strict-fields
4141
build-depends:
42-
aeson >=1.0 && <2.0
42+
aeson >=2.0 && <3.0
4343
, base >=4.7 && <5.0
4444
, base64-bytestring >1.0 && <2.0
4545
, bytestring >=0.10.0

modules/openapi-generator/src/main/resources/haskell-http-client/stack.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-18.6
1+
resolver: lts-19.6
22
build:
33
haddock-arguments:
44
haddock-args:

modules/openapi-generator/src/main/resources/haskell-http-client/tests/Instances.mustache

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import qualified Data.Set as Set
1313
import qualified Data.Text as T
1414
import qualified Data.Time as TI
1515
import qualified Data.Vector as V
16+
import Data.String (fromString)
1617

1718
import Control.Monad
1819
import Data.Char (isSpace)
@@ -53,8 +54,12 @@ instance Arbitrary Date where
5354
shrink (Date xs) = Date <$> shrink xs
5455

5556
-- | A naive Arbitrary instance for A.Value:
56-
instance Arbitrary A.Value where
57-
arbitrary = frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]
57+
-- instance Arbitrary A.Value where
58+
-- arbitrary = arbitraryValue
59+
60+
arbitraryValue :: Gen A.Value
61+
arbitraryValue =
62+
frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]
5863
where
5964
simpleTypes :: Gen A.Value
6065
simpleTypes =
@@ -64,7 +69,7 @@ instance Arbitrary A.Value where
6469
, (2, liftM (A.Number . fromIntegral) (arbitrary :: Gen Int))
6570
, (2, liftM (A.String . T.pack) (arbitrary :: Gen String))
6671
]
67-
mapF (k, v) = (T.pack k, v)
72+
mapF (k, v) = (fromString k, v)
6873
simpleAndArrays = frequency [(1, sized sizedArray), (4, simpleTypes)]
6974
arrayTypes = sized sizedArray
7075
objectTypes = sized sizedObject

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-AnotherFake.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-Fake.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-FakeClassnameTags123.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-Pet.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-Store.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

samples/client/petstore/haskell-http-client/docs/OpenAPIPetstore-API-User.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)