forked from loafle/openapi-generator-original
[haskell-http-client] relax Aeson constraint to allow Aeson 1 (#12486)
This commit is contained in:
@@ -14,6 +14,7 @@ Module : {{baseModule}}.Core
|
|||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
|
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
|
||||||
|
|
||||||
module {{baseModule}}.Core where
|
module {{baseModule}}.Core where
|
||||||
@@ -419,7 +420,11 @@ _applyAuthMethods req config@({{configType}} {configAuthMethods = as}) =
|
|||||||
-- * Utils
|
-- * Utils
|
||||||
|
|
||||||
-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
|
-- | 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
|
_omitNulls :: [(A.Key, A.Value)] -> A.Value
|
||||||
|
#else
|
||||||
|
_omitNulls :: [(Text, A.Value)] -> A.Value
|
||||||
|
#endif
|
||||||
_omitNulls = A.object . P.filter notNull
|
_omitNulls = A.object . P.filter notNull
|
||||||
where
|
where
|
||||||
notNull (_, A.Null) = False
|
notNull (_, A.Null) = False
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ library
|
|||||||
lib
|
lib
|
||||||
ghc-options: -Wall -funbox-strict-fields
|
ghc-options: -Wall -funbox-strict-fields
|
||||||
build-depends:
|
build-depends:
|
||||||
aeson >=2.0 && <3.0
|
aeson >=1.0 && <3.0
|
||||||
, base >=4.7 && <5.0
|
, base >=4.7 && <5.0
|
||||||
, base64-bytestring >1.0 && <2.0
|
, base64-bytestring >1.0 && <2.0
|
||||||
, bytestring >=0.10.0
|
, bytestring >=0.10.0
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
||||||
|
|
||||||
module Instances where
|
module Instances where
|
||||||
@@ -53,9 +54,12 @@ instance Arbitrary Date where
|
|||||||
arbitrary = Date <$> arbitrary
|
arbitrary = Date <$> arbitrary
|
||||||
shrink (Date xs) = Date <$> shrink xs
|
shrink (Date xs) = Date <$> shrink xs
|
||||||
|
|
||||||
|
#if MIN_VERSION_aeson(2,0,0)
|
||||||
|
#else
|
||||||
-- | A naive Arbitrary instance for A.Value:
|
-- | A naive Arbitrary instance for A.Value:
|
||||||
-- instance Arbitrary A.Value where
|
instance Arbitrary A.Value where
|
||||||
-- arbitrary = arbitraryValue
|
arbitrary = arbitraryValue
|
||||||
|
#endif
|
||||||
|
|
||||||
arbitraryValue :: Gen A.Value
|
arbitraryValue :: Gen A.Value
|
||||||
arbitraryValue =
|
arbitraryValue =
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@ executable openapi-petstore-app
|
|||||||
Paths_openapi_petstore_app
|
Paths_openapi_petstore_app
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
build-depends:
|
build-depends:
|
||||||
aeson >=2.0 && <3.0
|
aeson >=1.0 && <3.0
|
||||||
, base >=4.7 && <5.0
|
, base >=4.7 && <5.0
|
||||||
, bytestring >=0.10.0 && <0.11
|
, bytestring >=0.10.0 && <0.11
|
||||||
, case-insensitive
|
, case-insensitive
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ dependencies:
|
|||||||
- mtl >=2.2.1
|
- mtl >=2.2.1
|
||||||
- unordered-containers
|
- unordered-containers
|
||||||
- containers >=0.5.0.0 && <0.8
|
- containers >=0.5.0.0 && <0.8
|
||||||
- aeson >=2.0 && <3.0
|
- aeson >=1.0 && <3.0
|
||||||
- bytestring >=0.10.0 && <0.11
|
- bytestring >=0.10.0 && <0.11
|
||||||
- http-types >=0.8 && <0.13
|
- http-types >=0.8 && <0.13
|
||||||
- http-client >=0.5 && <0.8
|
- http-client >=0.5 && <0.8
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ Module : OpenAPIPetstore.Core
|
|||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
|
{-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-unused-binds -fno-warn-unused-imports #-}
|
||||||
|
|
||||||
module OpenAPIPetstore.Core where
|
module OpenAPIPetstore.Core where
|
||||||
@@ -428,7 +429,11 @@ _applyAuthMethods req config@(OpenAPIPetstoreConfig {configAuthMethods = as}) =
|
|||||||
-- * Utils
|
-- * Utils
|
||||||
|
|
||||||
-- | Removes Null fields. (OpenAPI-Specification 2.0 does not allow Null in JSON)
|
-- | 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
|
_omitNulls :: [(A.Key, A.Value)] -> A.Value
|
||||||
|
#else
|
||||||
|
_omitNulls :: [(Text, A.Value)] -> A.Value
|
||||||
|
#endif
|
||||||
_omitNulls = A.object . P.filter notNull
|
_omitNulls = A.object . P.filter notNull
|
||||||
where
|
where
|
||||||
notNull (_, A.Null) = False
|
notNull (_, A.Null) = False
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ library
|
|||||||
lib
|
lib
|
||||||
ghc-options: -Wall -funbox-strict-fields
|
ghc-options: -Wall -funbox-strict-fields
|
||||||
build-depends:
|
build-depends:
|
||||||
aeson >=2.0 && <3.0
|
aeson >=1.0 && <3.0
|
||||||
, base >=4.7 && <5.0
|
, base >=4.7 && <5.0
|
||||||
, base64-bytestring >1.0 && <2.0
|
, base64-bytestring >1.0 && <2.0
|
||||||
, bytestring >=0.10.0
|
, bytestring >=0.10.0
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ dependencies:
|
|||||||
- mtl >=2.2.1
|
- mtl >=2.2.1
|
||||||
- unordered-containers
|
- unordered-containers
|
||||||
- containers >=0.5.0.0 && <0.7
|
- containers >=0.5.0.0 && <0.7
|
||||||
- aeson >=2.0 && <3.0
|
- aeson >=1.0 && <3.0
|
||||||
- bytestring >=0.10.0
|
- bytestring >=0.10.0
|
||||||
- http-types >=0.8 && <0.13
|
- http-types >=0.8 && <0.13
|
||||||
- http-client >=0.5 && <0.8
|
- http-client >=0.5 && <0.8
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
||||||
|
|
||||||
module Instances where
|
module Instances where
|
||||||
@@ -52,9 +53,12 @@ instance Arbitrary Date where
|
|||||||
arbitrary = Date <$> arbitrary
|
arbitrary = Date <$> arbitrary
|
||||||
shrink (Date xs) = Date <$> shrink xs
|
shrink (Date xs) = Date <$> shrink xs
|
||||||
|
|
||||||
|
#if MIN_VERSION_aeson(2,0,0)
|
||||||
|
#else
|
||||||
-- | A naive Arbitrary instance for A.Value:
|
-- | A naive Arbitrary instance for A.Value:
|
||||||
-- instance Arbitrary A.Value where
|
instance Arbitrary A.Value where
|
||||||
-- arbitrary = arbitraryValue
|
arbitrary = arbitraryValue
|
||||||
|
#endif
|
||||||
|
|
||||||
arbitraryValue :: Gen A.Value
|
arbitraryValue :: Gen A.Value
|
||||||
arbitraryValue =
|
arbitraryValue =
|
||||||
|
|||||||
Reference in New Issue
Block a user