forked from loafle/openapi-generator-original
[haskell-http-client] relax Aeson constraint to allow Aeson 1 (#12486)
This commit is contained in:
parent
e823290c8f
commit
078232acb5
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
||||
|
||||
module Instances where
|
||||
@ -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 =
|
||||
|
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
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-matches #-}
|
||||
|
||||
module Instances where
|
||||
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user