Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[haskell-http-client] relax Aeson constraint to allow Aeson 1 #12486

Merged
merged 1 commit into from
May 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Module : {{baseModule}}.Core
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}

module {{baseModule}}.Core where
Expand Down Expand Up @@ -419,7 +420,11 @@ _applyAuthMethods req config@({{configType}} {configAuthMethods = as}) =
-- * Utils

-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
#if MIN_VERSION_aeson(2,0,0)
_omitNulls :: [(A.Key, A.Value)] -> A.Value
#else
_omitNulls :: [(Text, A.Value)] -> A.Value
#endif
_omitNulls = A.object . P.filter notNull
where
notNull (_, A.Null) = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ library
lib
ghc-options: -Wall -funbox-strict-fields
build-depends:
aeson >=2.0 && <3.0
aeson >=1.0 && <3.0
, base >=4.7 && <5.0
, base64-bytestring >1.0 && <2.0
, bytestring >=0.10.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}

module Instances where
Expand Down Expand Up @@ -53,9 +54,12 @@ instance Arbitrary Date where
arbitrary = Date <$> arbitrary
shrink (Date xs) = Date <$> shrink xs

#if MIN_VERSION_aeson(2,0,0)
#else
-- | A naive Arbitrary instance for A.Value:
-- instance Arbitrary A.Value where
-- arbitrary = arbitraryValue
instance Arbitrary A.Value where
arbitrary = arbitraryValue
#endif

arbitraryValue :: Gen A.Value
arbitraryValue =
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,107 changes: 556 additions & 551 deletions samples/client/petstore/haskell-http-client/docs/src/OpenAPIPetstore.Core.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ executable openapi-petstore-app
Paths_openapi_petstore_app
ghc-options: -Wall
build-depends:
aeson >=2.0 && <3.0
aeson >=1.0 && <3.0
, base >=4.7 && <5.0
, bytestring >=0.10.0 && <0.11
, case-insensitive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- mtl >=2.2.1
- unordered-containers
- containers >=0.5.0.0 && <0.8
- aeson >=2.0 && <3.0
- aeson >=1.0 && <3.0
- bytestring >=0.10.0 && <0.11
- http-types >=0.8 && <0.13
- http-client >=0.5 && <0.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Module : OpenAPIPetstore.Core
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}

module OpenAPIPetstore.Core where
Expand Down Expand Up @@ -428,7 +429,11 @@ _applyAuthMethods req config@(OpenAPIPetstoreConfig {configAuthMethods = as}) =
-- * Utils

-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
#if MIN_VERSION_aeson(2,0,0)
_omitNulls :: [(A.Key, A.Value)] -> A.Value
#else
_omitNulls :: [(Text, A.Value)] -> A.Value
#endif
_omitNulls = A.object . P.filter notNull
where
notNull (_, A.Null) = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ library
lib
ghc-options: -Wall -funbox-strict-fields
build-depends:
aeson >=2.0 && <3.0
aeson >=1.0 && <3.0
, base >=4.7 && <5.0
, base64-bytestring >1.0 && <2.0
, bytestring >=0.10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies:
- mtl >=2.2.1
- unordered-containers
- containers >=0.5.0.0 && <0.7
- aeson >=2.0 && <3.0
- aeson >=1.0 && <3.0
- bytestring >=0.10.0
- http-types >=0.8 && <0.13
- http-client >=0.5 && <0.8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}

module Instances where
Expand Down Expand Up @@ -52,9 +53,12 @@ instance Arbitrary Date where
arbitrary = Date <$> arbitrary
shrink (Date xs) = Date <$> shrink xs

#if MIN_VERSION_aeson(2,0,0)
#else
-- | A naive Arbitrary instance for A.Value:
-- instance Arbitrary A.Value where
-- arbitrary = arbitraryValue
instance Arbitrary A.Value where
arbitrary = arbitraryValue
#endif

arbitraryValue :: Gen A.Value
arbitraryValue =
Expand Down