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] Update haskell-http-client generator to Aeson 2.x #12309

Merged
merged 5 commits into from
May 7, 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 @@ -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
Expand Down Expand Up @@ -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
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 >=1.0 && <2.0
aeson >=2.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,4 +1,4 @@
resolver: lts-18.6
resolver: lts-19.6
build:
haddock-arguments:
haddock-args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import qualified Data.Set as Set
import qualified Data.Text as T
import qualified Data.Time as TI
import qualified Data.Vector as V
import Data.String (fromString)

import Control.Monad
import Data.Char (isSpace)
Expand Down Expand Up @@ -53,8 +54,12 @@ instance Arbitrary Date where
shrink (Date xs) = Date <$> shrink xs

-- | A naive Arbitrary instance for A.Value:
instance Arbitrary A.Value where
arbitrary = frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]
-- instance Arbitrary A.Value where
-- arbitrary = arbitraryValue

arbitraryValue :: Gen A.Value
arbitraryValue =
frequency [(3, simpleTypes), (1, arrayTypes), (1, objectTypes)]
where
simpleTypes :: Gen A.Value
simpleTypes =
Expand All @@ -64,7 +69,7 @@ instance Arbitrary A.Value where
, (2, liftM (A.Number . fromIntegral) (arbitrary :: Gen Int))
, (2, liftM (A.String . T.pack) (arbitrary :: Gen String))
]
mapF (k, v) = (T.pack k, v)
mapF (k, v) = (fromString k, v)
simpleAndArrays = frequency [(1, sized sizedArray), (4, simpleTypes)]
arrayTypes = sized sizedArray
objectTypes = sized sizedObject
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>OpenAPIPetstore.API</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">openapi-petstore-0.1.0.0: Auto-generated openapi-petstore API Client</span><ul class="links" id="page-menu"><li><a href="src/OpenAPIPetstore.API.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">OpenAPIPetstore.API</p></div><div id="description"><p class="caption">Description</p><div class="doc empty">&nbsp;</div></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-AnotherFake.html">OpenAPIPetstore.API.AnotherFake</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Fake.html">OpenAPIPetstore.API.Fake</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-FakeClassnameTags123.html">OpenAPIPetstore.API.FakeClassnameTags123</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Pet.html">OpenAPIPetstore.API.Pet</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Store.html">OpenAPIPetstore.API.Store</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-User.html">OpenAPIPetstore.API.User</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.24.2</p></div></body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>OpenAPIPetstore.API</title><link href="linuwial.css" rel="stylesheet" type="text/css" title="Linuwial" /><link rel="stylesheet" type="text/css" href="quick-jump.css" /><link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700" /><script src="haddock-bundle.min.js" async="async" type="text/javascript"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({ tex2jax: { processClass: "mathjax", ignoreClass: ".*" } });</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script></head><body><div id="package-header"><span class="caption">openapi-petstore-0.1.0.0: Auto-generated openapi-petstore API Client</span><ul class="links" id="page-menu"><li><a href="src/OpenAPIPetstore.API.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe-Inferred</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">OpenAPIPetstore.API</p></div><div id="description"><p class="caption">Description</p><div class="doc empty">&nbsp;</div></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-AnotherFake.html">OpenAPIPetstore.API.AnotherFake</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Fake.html">OpenAPIPetstore.API.Fake</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-FakeClassnameTags123.html">OpenAPIPetstore.API.FakeClassnameTags123</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Pet.html">OpenAPIPetstore.API.Pet</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-Store.html">OpenAPIPetstore.API.Store</a></p></div><div class="top"><p class="src">module <a href="OpenAPIPetstore-API-User.html">OpenAPIPetstore.API.User</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.25.1</p></div></body></html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading