From 568f8198490ca67b39f2b311149a6f1b8e4ff35e Mon Sep 17 00:00:00 2001 From: Nick Van den Broeck Date: Sat, 10 Aug 2024 11:05:51 -0600 Subject: [PATCH 1/2] Updated dependencies to NixOS-24.05 --- flake.lock | 98 ++++++------------- flake.nix | 2 +- .../src/OpenAPI/Generate/OptParse.hs | 3 +- 3 files changed, 34 insertions(+), 69 deletions(-) diff --git a/flake.lock b/flake.lock index 4bfde33..30cb4e0 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "autodocodec": { "flake": false, "locked": { - "lastModified": 1701673930, - "narHash": "sha256-Mv8LNgJrQpHpuxg7jMuYuUoLeWCW+0OvqST4KNJYH9k=", + "lastModified": 1722952210, + "narHash": "sha256-+vz0En2dkS0nfOq12QAJtV6GcdP0WoDv7HwzrMIsnGo=", "owner": "NorfairKing", "repo": "autodocodec", - "rev": "958a1c51fbf2f166974a60e2d0a5d266483baff5", + "rev": "ac36615cb344ec43259fb65cafe3e55308ce4662", "type": "github" }, "original": { @@ -19,11 +19,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -50,24 +50,6 @@ "type": "github" } }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "gitignore": { "inputs": { "nixpkgs": [ @@ -76,11 +58,11 @@ ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -91,43 +73,43 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701539137, - "narHash": "sha256-nVO/5QYpf1GwjvtpXhyxx5M3U/WN0MwBro4Lsk+9mL0=", + "lastModified": 1722987190, + "narHash": "sha256-68hmex5efCiM2aZlAAEcQgmFI4ZwWt8a80vOeB/5w3A=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "933d7dc155096e7575d207be6fb7792bc9f34f6d", + "rev": "21cc704b5e918c5fbf4f9fff22b4ac2681706d90", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-stable": { "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1689261696, - "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", "type": "github" }, "original": { @@ -140,17 +122,16 @@ "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", - "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": "nixpkgs_2", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1700922917, - "narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=", + "lastModified": 1723202784, + "narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78", + "rev": "c7012d0c18567c889b948781bc74a501e92275d1", "type": "github" }, "original": { @@ -173,11 +154,11 @@ "safe-coloured-text": { "flake": false, "locked": { - "lastModified": 1701675196, - "narHash": "sha256-VXPEeuP1BmYzCSe+1Qt715c3GiLUQ6XyPdnNYOhEQZc=", + "lastModified": 1722709522, + "narHash": "sha256-zglWqKISYz34A+/PvqwvwrbQYSEcko8C595VAeINitw=", "owner": "NorfairKing", "repo": "safe-coloured-text", - "rev": "5efd54e49de780700cd8af2039dff1579c75483c", + "rev": "046f10147a058c00c2706d98c341219e3cbc7669", "type": "github" }, "original": { @@ -189,11 +170,11 @@ "sydtest": { "flake": false, "locked": { - "lastModified": 1701869719, - "narHash": "sha256-+qrn2utn8W754ifrm5phT3DtAtK78vjlNObFWRHRxHg=", + "lastModified": 1722766036, + "narHash": "sha256-i7N8HKkFPUfnOOmj47Di/XnQS66mUzTG6HISUccNhOA=", "owner": "NorfairKing", "repo": "sydtest", - "rev": "d22ec20ca32854f880295cb373f84e874be916bb", + "rev": "23baea50a08857baf3121fc55096c40a93ff5f17", "type": "github" }, "original": { @@ -217,29 +198,14 @@ "type": "github" } }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "validity": { "flake": false, "locked": { - "lastModified": 1701673254, - "narHash": "sha256-TsSkc2kqAoJ/S6HaK4t4S9r7nDvcHEPiNzMjlPnkb4Y=", + "lastModified": 1722943924, + "narHash": "sha256-hq5FwDFW+02u5Qsx8v1KWoQUsY6S6ufI4WYKZ6yhYUA=", "owner": "NorfairKing", "repo": "validity", - "rev": "57c4897ccfeb3de60489e0328113798f059ef140", + "rev": "51b8843b9bd5228160b99f653d3271147245d689", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e723bbb..527b4e8 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "openapi-code-generator"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-23.11"; + nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-24.05"; pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; validity.url = "github:NorfairKing/validity"; validity.flake = false; diff --git a/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs b/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs index 7cac6c8..5ad505e 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/OptParse.hs @@ -21,7 +21,6 @@ import OpenAPI.Generate.OptParse.Configuration import OpenAPI.Generate.OptParse.Flags import OpenAPI.Generate.OptParse.Types import Options.Applicative -import Options.Applicative.Help (string) import Path import Path.IO import System.Exit @@ -178,7 +177,7 @@ flagsParser = info (helper <*> parseFlags) ( fullDesc - <> footerDoc (Just $ string footerStr) + <> footer footerStr <> progDesc "This tool can be used to generate Haskell code from OpenAPI 3 specifications. For more information see https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator." <> header "Generate Haskell code from OpenAPI 3 specifications" ) From 71e7c4aaa132938962d6f53338bdf75f335cf5a0 Mon Sep 17 00:00:00 2001 From: Nick Van den Broeck Date: Sat, 10 Aug 2024 11:18:57 -0600 Subject: [PATCH 2/2] Fixed CI --- example/generatedCode/src/OpenAPI/Common.hs | 20 +++++++++---------- .../OpenAPI/Operations/FindPetsByStatus.hs | 6 +++--- .../src/OpenAPI/Operations/FindPetsByTags.hs | 6 +++--- .../generatedCode/src/OpenAPI/Types/Pet.hs | 4 ++-- example/src/Lib.hs | 6 +++--- openapi3-code-generator/src/OpenAPI/Common.hs | 20 +++++++++---------- .../src/OpenAPI/Generate/Doc.hs | 6 +++--- .../src/OpenAPI/Generate/Internal/Util.hs | 6 +++--- .../OpenAPI/Generate/Types/Referencable.hs | 2 +- testing/golden-output/src/OpenAPI/Common.hs | 20 +++++++++---------- .../golden-output/src/OpenAPI/Types/Dog.hs | 2 +- .../src/OpenAPI/Types/Mischling.hs | 4 ++-- .../src/OpenAPI/Types/PetByAge.hs | 2 +- .../golden-output/src/OpenAPI/Types/Test8.hs | 4 ++-- testing/level2/official-petstore/src/Lib.hs | 6 +++--- .../petstore-running-example/src/Lib.hs | 16 +++++++-------- testing/level2/stripe-api/src/Lib.hs | 8 ++++---- .../petstore-running-example/src/Lib.hs | 14 ++++++------- .../petstore-running-example/test/Spec.hs | 2 +- 19 files changed, 77 insertions(+), 77 deletions(-) diff --git a/example/generatedCode/src/OpenAPI/Common.hs b/example/generatedCode/src/OpenAPI/Common.hs index f3e27c9..9d98534 100755 --- a/example/generatedCode/src/OpenAPI/Common.hs +++ b/example/generatedCode/src/OpenAPI/Common.hs @@ -64,17 +64,17 @@ import qualified Data.HashMap.Strict as HMap -- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away, -- so that it can be used for testing -class Monad m => MonadHTTP m where +class (Monad m) => MonadHTTP m where httpBS :: HS.Request -> m (HS.Response BS.ByteString) -- | This instance is the default instance used for production code instance MonadHTTP IO where httpBS = HS.httpBS -instance MonadHTTP m => MonadHTTP (MR.ReaderT r m) where +instance (MonadHTTP m) => MonadHTTP (MR.ReaderT r m) where httpBS = MT.lift . httpBS -instance MonadHTTP m => MonadHTTP (ClientT m) where +instance (MonadHTTP m) => MonadHTTP (ClientT m) where httpBS = MT.lift . httpBS -- | The monad in which the operations can be run. @@ -87,7 +87,7 @@ newtype ClientT m a = ClientT (MR.ReaderT Configuration m a) instance MT.MonadTrans ClientT where lift = ClientT . MT.lift -instance MIO.MonadIO m => MIO.MonadIO (ClientT m) where +instance (MIO.MonadIO m) => MIO.MonadIO (ClientT m) where liftIO = ClientT . MIO.liftIO -- | Utility type which uses 'IO' as underlying monad @@ -156,7 +156,7 @@ anonymousSecurityScheme = id -- -- It makes a concrete Call to a Server without a body doCallWithConfiguration :: - MonadHTTP m => + (MonadHTTP m) => -- | Configuration options like base URL and security scheme Configuration -> -- | HTTP method (GET, POST, etc.) @@ -173,7 +173,7 @@ doCallWithConfiguration config method path queryParams = -- | Same as 'doCallWithConfiguration' but run in a 'MR.ReaderT' environment which contains the configuration. -- This is useful if multiple calls have to be executed with the same configuration. doCallWithConfigurationM :: - MonadHTTP m => + (MonadHTTP m) => Text -> Text -> [QueryParameter] -> @@ -291,7 +291,7 @@ serializeQueryParam QueryParameter {..} = ) $ jsonToFormDataFlat Nothing value -encodeStrict :: Aeson.ToJSON a => a -> BS.ByteString +encodeStrict :: (Aeson.ToJSON a) => a -> BS.ByteString encodeStrict = LBS.toStrict . Aeson.encode jsonToFormDataFlat :: Maybe Text -> Aeson.Value -> [(Maybe Text, BS.ByteString)] @@ -343,7 +343,7 @@ jsonToFormDataPrefixed prefix (Aeson.Array vector) = -- | This function makes the code generation for URL parameters easier as it allows to stringify a value -- -- The 'Show' class is not sufficient as strings should not be stringified with quotes. -stringifyModel :: Aeson.ToJSON a => a -> Text +stringifyModel :: (Aeson.ToJSON a) => a -> Text stringifyModel x = case Aeson.toJSON x of Aeson.String s -> s v -> toStrict $ toLazyText $ encodeToTextBuilder v @@ -378,14 +378,14 @@ instance Aeson.FromJSON JsonDateTime where data Nullable a = NonNull a | Null deriving (Show, Eq) -instance Aeson.ToJSON a => Aeson.ToJSON (Nullable a) where +instance (Aeson.ToJSON a) => Aeson.ToJSON (Nullable a) where toJSON Null = Aeson.Null toJSON (NonNull x) = Aeson.toJSON x toEncoding Null = Encoding.null_ toEncoding (NonNull x) = Aeson.toEncoding x -instance Aeson.FromJSON a => Aeson.FromJSON (Nullable a) where +instance (Aeson.FromJSON a) => Aeson.FromJSON (Nullable a) where parseJSON Aeson.Null = pure Null parseJSON x = NonNull <$> Aeson.parseJSON x diff --git a/example/generatedCode/src/OpenAPI/Operations/FindPetsByStatus.hs b/example/generatedCode/src/OpenAPI/Operations/FindPetsByStatus.hs index b7f4da6..d255652 100755 --- a/example/generatedCode/src/OpenAPI/Operations/FindPetsByStatus.hs +++ b/example/generatedCode/src/OpenAPI/Operations/FindPetsByStatus.hs @@ -51,7 +51,7 @@ import OpenAPI.Types findPetsByStatus :: forall m . OpenAPI.Common.MonadHTTP m => [FindPetsByStatusParametersStatus] -- ^ status: Status values that need to be considered for filter -> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response FindPetsByStatusResponse) -- ^ Monadic computation which returns the result of the operation findPetsByStatus status = GHC.Base.fmap (\response_0 -> GHC.Base.fmap (Data.Either.either FindPetsByStatusResponseError GHC.Base.id GHC.Base.. (\response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> FindPetsByStatusResponse200 Data.Functor.<$> (Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String - ([Pet])) + [Pet]) | (\status_2 -> Network.HTTP.Types.Status.statusCode status_2 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByStatusResponse400 | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_0) response_0) (OpenAPI.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/findByStatus" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "status") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON status) (Data.Text.Internal.pack "form") GHC.Types.True]) -- | Defines the enum schema located at @paths.\/pet\/findByStatus.GET.parameters.[0].schema.items@ in the specification. @@ -80,7 +80,7 @@ instance Data.Aeson.Types.FromJSON.FromJSON FindPetsByStatusParametersStatus -- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'FindPetsByStatusResponseError' is used. data FindPetsByStatusResponse = FindPetsByStatusResponseError GHC.Base.String -- ^ Means either no matching case available or a parse error - | FindPetsByStatusResponse200 ([Pet]) -- ^ successful operation + | FindPetsByStatusResponse200 [Pet] -- ^ successful operation | FindPetsByStatusResponse400 -- ^ Invalid status value deriving (GHC.Show.Show, GHC.Classes.Eq) -- | > GET /pet/findByStatus @@ -91,7 +91,7 @@ findPetsByStatusWithConfiguration :: forall m . OpenAPI.Common.MonadHTTP m => Op -> m (Network.HTTP.Client.Types.Response FindPetsByStatusResponse) -- ^ Monadic computation which returns the result of the operation findPetsByStatusWithConfiguration config status = GHC.Base.fmap (\response_3 -> GHC.Base.fmap (Data.Either.either FindPetsByStatusResponseError GHC.Base.id GHC.Base.. (\response body -> if | (\status_4 -> Network.HTTP.Types.Status.statusCode status_4 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> FindPetsByStatusResponse200 Data.Functor.<$> (Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String - ([Pet])) + [Pet]) | (\status_5 -> Network.HTTP.Types.Status.statusCode status_5 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByStatusResponse400 | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_3) response_3) (OpenAPI.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/findByStatus" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "status") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON status) (Data.Text.Internal.pack "form") GHC.Types.True]) -- | > GET /pet/findByStatus diff --git a/example/generatedCode/src/OpenAPI/Operations/FindPetsByTags.hs b/example/generatedCode/src/OpenAPI/Operations/FindPetsByTags.hs index 9881630..e57c18a 100755 --- a/example/generatedCode/src/OpenAPI/Operations/FindPetsByTags.hs +++ b/example/generatedCode/src/OpenAPI/Operations/FindPetsByTags.hs @@ -51,7 +51,7 @@ import OpenAPI.Types findPetsByTags :: forall m . OpenAPI.Common.MonadHTTP m => [Data.Text.Internal.Text] -- ^ tags: Tags to filter by -> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response FindPetsByTagsResponse) -- ^ Monadic computation which returns the result of the operation findPetsByTags tags = GHC.Base.fmap (\response_0 -> GHC.Base.fmap (Data.Either.either FindPetsByTagsResponseError GHC.Base.id GHC.Base.. (\response body -> if | (\status_1 -> Network.HTTP.Types.Status.statusCode status_1 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> FindPetsByTagsResponse200 Data.Functor.<$> (Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String - ([Pet])) + [Pet]) | (\status_2 -> Network.HTTP.Types.Status.statusCode status_2 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByTagsResponse400 | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_0) response_0) (OpenAPI.Common.doCallWithConfigurationM (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/findByTags" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "tags") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON tags) (Data.Text.Internal.pack "form") GHC.Types.True]) -- | Represents a response of the operation 'findPetsByTags'. @@ -59,7 +59,7 @@ findPetsByTags tags = GHC.Base.fmap (\response_0 -> GHC.Base.fmap (Data.Either.e -- The response constructor is chosen by the status code of the response. If no case matches (no specific case for the response code, no range case, no default case), 'FindPetsByTagsResponseError' is used. data FindPetsByTagsResponse = FindPetsByTagsResponseError GHC.Base.String -- ^ Means either no matching case available or a parse error - | FindPetsByTagsResponse200 ([Pet]) -- ^ successful operation + | FindPetsByTagsResponse200 [Pet] -- ^ successful operation | FindPetsByTagsResponse400 -- ^ Invalid tag value deriving (GHC.Show.Show, GHC.Classes.Eq) -- | > GET /pet/findByTags @@ -70,7 +70,7 @@ findPetsByTagsWithConfiguration :: forall m . OpenAPI.Common.MonadHTTP m => Open -> m (Network.HTTP.Client.Types.Response FindPetsByTagsResponse) -- ^ Monadic computation which returns the result of the operation findPetsByTagsWithConfiguration config tags = GHC.Base.fmap (\response_3 -> GHC.Base.fmap (Data.Either.either FindPetsByTagsResponseError GHC.Base.id GHC.Base.. (\response body -> if | (\status_4 -> Network.HTTP.Types.Status.statusCode status_4 GHC.Classes.== 200) (Network.HTTP.Client.Types.responseStatus response) -> FindPetsByTagsResponse200 Data.Functor.<$> (Data.Aeson.eitherDecodeStrict body :: Data.Either.Either GHC.Base.String - ([Pet])) + [Pet]) | (\status_5 -> Network.HTTP.Types.Status.statusCode status_5 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByTagsResponse400 | GHC.Base.otherwise -> Data.Either.Left "Missing default response type") response_3) response_3) (OpenAPI.Common.doCallWithConfiguration config (Data.Text.toUpper GHC.Base.$ Data.Text.Internal.pack "GET") "/pet/findByTags" [OpenAPI.Common.QueryParameter (Data.Text.Internal.pack "tags") (GHC.Maybe.Just GHC.Base.$ Data.Aeson.Types.ToJSON.toJSON tags) (Data.Text.Internal.pack "form") GHC.Types.True]) -- | > GET /pet/findByTags diff --git a/example/generatedCode/src/OpenAPI/Types/Pet.hs b/example/generatedCode/src/OpenAPI/Types/Pet.hs index 2effc3c..6097324 100755 --- a/example/generatedCode/src/OpenAPI/Types/Pet.hs +++ b/example/generatedCode/src/OpenAPI/Types/Pet.hs @@ -46,11 +46,11 @@ data Pet = Pet { -- | name , petName :: Data.Text.Internal.Text -- | photoUrls - , petPhotoUrls :: ([Data.Text.Internal.Text]) + , petPhotoUrls :: [Data.Text.Internal.Text] -- | status: pet status in the store , petStatus :: (GHC.Maybe.Maybe PetStatus) -- | tags - , petTags :: (GHC.Maybe.Maybe ([Tag])) + , petTags :: (GHC.Maybe.Maybe [Tag]) } deriving (GHC.Show.Show , GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON Pet diff --git a/example/src/Lib.hs b/example/src/Lib.hs index 22a3523..3d66d7f 100644 --- a/example/src/Lib.hs +++ b/example/src/Lib.hs @@ -7,7 +7,7 @@ import Network.HTTP.Client import OpenAPI import OpenAPI.Common -runAddPet :: MonadHTTP m => m (Response AddPetResponse) +runAddPet :: (MonadHTTP m) => m (Response AddPetResponse) runAddPet = runWithConfiguration defaultConfiguration (addPet myPet) where myPet = @@ -20,10 +20,10 @@ runAddPet = runWithConfiguration defaultConfiguration (addPet myPet) petTags = Nothing } -runGetInventory :: MonadHTTP m => m (Response GetInventoryResponse) +runGetInventory :: (MonadHTTP m) => m (Response GetInventoryResponse) runGetInventory = runWithConfiguration defaultConfiguration getInventory -runFindPetsByStatus :: MonadHTTP m => m (Response FindPetsByStatusResponse) +runFindPetsByStatus :: (MonadHTTP m) => m (Response FindPetsByStatusResponse) runFindPetsByStatus = runWithConfiguration defaultConfiguration diff --git a/openapi3-code-generator/src/OpenAPI/Common.hs b/openapi3-code-generator/src/OpenAPI/Common.hs index d1c29e3..3ae31ac 100644 --- a/openapi3-code-generator/src/OpenAPI/Common.hs +++ b/openapi3-code-generator/src/OpenAPI/Common.hs @@ -64,17 +64,17 @@ import qualified Data.HashMap.Strict as HMap -- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away, -- so that it can be used for testing -class Monad m => MonadHTTP m where +class (Monad m) => MonadHTTP m where httpBS :: HS.Request -> m (HS.Response BS.ByteString) -- | This instance is the default instance used for production code instance MonadHTTP IO where httpBS = HS.httpBS -instance MonadHTTP m => MonadHTTP (MR.ReaderT r m) where +instance (MonadHTTP m) => MonadHTTP (MR.ReaderT r m) where httpBS = MT.lift . httpBS -instance MonadHTTP m => MonadHTTP (ClientT m) where +instance (MonadHTTP m) => MonadHTTP (ClientT m) where httpBS = MT.lift . httpBS -- | The monad in which the operations can be run. @@ -87,7 +87,7 @@ newtype ClientT m a = ClientT (MR.ReaderT Configuration m a) instance MT.MonadTrans ClientT where lift = ClientT . MT.lift -instance MIO.MonadIO m => MIO.MonadIO (ClientT m) where +instance (MIO.MonadIO m) => MIO.MonadIO (ClientT m) where liftIO = ClientT . MIO.liftIO -- | Utility type which uses 'IO' as underlying monad @@ -156,7 +156,7 @@ anonymousSecurityScheme = id -- -- It makes a concrete Call to a Server without a body doCallWithConfiguration :: - MonadHTTP m => + (MonadHTTP m) => -- | Configuration options like base URL and security scheme Configuration -> -- | HTTP method (GET, POST, etc.) @@ -173,7 +173,7 @@ doCallWithConfiguration config method path queryParams = -- | Same as 'doCallWithConfiguration' but run in a 'MR.ReaderT' environment which contains the configuration. -- This is useful if multiple calls have to be executed with the same configuration. doCallWithConfigurationM :: - MonadHTTP m => + (MonadHTTP m) => Text -> Text -> [QueryParameter] -> @@ -291,7 +291,7 @@ serializeQueryParam QueryParameter {..} = ) $ jsonToFormDataFlat Nothing value -encodeStrict :: Aeson.ToJSON a => a -> BS.ByteString +encodeStrict :: (Aeson.ToJSON a) => a -> BS.ByteString encodeStrict = LBS.toStrict . Aeson.encode jsonToFormDataFlat :: Maybe Text -> Aeson.Value -> [(Maybe Text, BS.ByteString)] @@ -343,7 +343,7 @@ jsonToFormDataPrefixed prefix (Aeson.Array vector) = -- | This function makes the code generation for URL parameters easier as it allows to stringify a value -- -- The 'Show' class is not sufficient as strings should not be stringified with quotes. -stringifyModel :: Aeson.ToJSON a => a -> Text +stringifyModel :: (Aeson.ToJSON a) => a -> Text stringifyModel x = case Aeson.toJSON x of Aeson.String s -> s v -> toStrict $ toLazyText $ encodeToTextBuilder v @@ -378,14 +378,14 @@ instance Aeson.FromJSON JsonDateTime where data Nullable a = NonNull a | Null deriving (Show, Eq) -instance Aeson.ToJSON a => Aeson.ToJSON (Nullable a) where +instance (Aeson.ToJSON a) => Aeson.ToJSON (Nullable a) where toJSON Null = Aeson.Null toJSON (NonNull x) = Aeson.toJSON x toEncoding Null = Encoding.null_ toEncoding (NonNull x) = Aeson.toEncoding x -instance Aeson.FromJSON a => Aeson.FromJSON (Nullable a) where +instance (Aeson.FromJSON a) => Aeson.FromJSON (Nullable a) where parseJSON Aeson.Null = pure Null parseJSON x = NonNull <$> Aeson.parseJSON x diff --git a/openapi3-code-generator/src/OpenAPI/Generate/Doc.hs b/openapi3-code-generator/src/OpenAPI/Generate/Doc.hs index f4fa3eb..7fd35b8 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/Doc.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/Doc.hs @@ -32,7 +32,7 @@ typeAliasModule :: String typeAliasModule = "TypeAlias" -- | Empty document inside an 'Applicative' (typically 'Language.Haskell.TH.Q') -emptyDoc :: Applicative f => f Doc +emptyDoc :: (Applicative f) => f Doc emptyDoc = pure empty haddockIntro :: Doc @@ -69,7 +69,7 @@ generatorNote :: Doc -> Doc generatorNote = line "-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator." . emptyLine -- | Append a 'Doc' to another inside an 'Applicative' (typically 'Language.Haskell.TH.Q') -appendDoc :: Applicative f => f Doc -> f Doc -> f Doc +appendDoc :: (Applicative f) => f Doc -> f Doc -> f Doc appendDoc = Applicative.liftA2 ($$) -- | Generate a Haddock comment with multiple lines @@ -90,7 +90,7 @@ generateHaddockCommentWithoutNewlines [x] = haddockIntro <+> textToDoc x generateHaddockCommentWithoutNewlines xs = generateHaddockCommentWithoutNewlines (init xs) $$ haddockLine - <+> textToDoc (last xs) + <+> textToDoc (last xs) -- | Escape text for use in Haddock comment escapeText :: Text -> Text diff --git a/openapi3-code-generator/src/OpenAPI/Generate/Internal/Util.hs b/openapi3-code-generator/src/OpenAPI/Generate/Internal/Util.hs index fc25483..f3b07c3 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/Internal/Util.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/Internal/Util.hs @@ -155,7 +155,7 @@ joinWithPoint :: [String] -> String joinWithPoint = joinWith "." -- | Concat a list of values separated by an other value -joinWith :: Monoid a => a -> [a] -> a +joinWith :: (Monoid a) => a -> [a] -> a joinWith _ [] = mempty joinWith separator xs = foldr1 @@ -165,10 +165,10 @@ joinWith separator xs = -- | A version of 'Data.Maybe.mapMaybe' that works with a monadic predicate. -- from https://hackage.haskell.org/package/extra-1.7.1/docs/src/Control.Monad.Extra.html#mapMaybeM copied -mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] +mapMaybeM :: (Monad m) => (a -> m (Maybe b)) -> [a] -> m [b] mapMaybeM op = foldr f (pure []) where - f x xs = do x' <- op x; case x' of { Nothing -> xs; Just x'' -> do { xs' <- xs; pure $ x'' : xs' } } + f x xs = do x' <- op x; case x' of Nothing -> xs; Just x'' -> do xs' <- xs; pure $ x'' : xs' -- | Lifted version of '<>' which can be used with 'Semigroup's inside 'Applicative's liftedAppend :: (Applicative f, Semigroup a) => f a -> f a -> f a diff --git a/openapi3-code-generator/src/OpenAPI/Generate/Types/Referencable.hs b/openapi3-code-generator/src/OpenAPI/Generate/Types/Referencable.hs index 54ca775..e0cf611 100644 --- a/openapi3-code-generator/src/OpenAPI/Generate/Types/Referencable.hs +++ b/openapi3-code-generator/src/OpenAPI/Generate/Types/Referencable.hs @@ -17,7 +17,7 @@ data Referencable a Concrete a deriving (Show, Eq, Ord) -instance FromJSON a => FromJSON (Referencable a) where +instance (FromJSON a) => FromJSON (Referencable a) where parseJSON (Object v) = do maybeReference <- v .:? "$ref" case maybeReference of diff --git a/testing/golden-output/src/OpenAPI/Common.hs b/testing/golden-output/src/OpenAPI/Common.hs index f3e27c9..9d98534 100755 --- a/testing/golden-output/src/OpenAPI/Common.hs +++ b/testing/golden-output/src/OpenAPI/Common.hs @@ -64,17 +64,17 @@ import qualified Data.HashMap.Strict as HMap -- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away, -- so that it can be used for testing -class Monad m => MonadHTTP m where +class (Monad m) => MonadHTTP m where httpBS :: HS.Request -> m (HS.Response BS.ByteString) -- | This instance is the default instance used for production code instance MonadHTTP IO where httpBS = HS.httpBS -instance MonadHTTP m => MonadHTTP (MR.ReaderT r m) where +instance (MonadHTTP m) => MonadHTTP (MR.ReaderT r m) where httpBS = MT.lift . httpBS -instance MonadHTTP m => MonadHTTP (ClientT m) where +instance (MonadHTTP m) => MonadHTTP (ClientT m) where httpBS = MT.lift . httpBS -- | The monad in which the operations can be run. @@ -87,7 +87,7 @@ newtype ClientT m a = ClientT (MR.ReaderT Configuration m a) instance MT.MonadTrans ClientT where lift = ClientT . MT.lift -instance MIO.MonadIO m => MIO.MonadIO (ClientT m) where +instance (MIO.MonadIO m) => MIO.MonadIO (ClientT m) where liftIO = ClientT . MIO.liftIO -- | Utility type which uses 'IO' as underlying monad @@ -156,7 +156,7 @@ anonymousSecurityScheme = id -- -- It makes a concrete Call to a Server without a body doCallWithConfiguration :: - MonadHTTP m => + (MonadHTTP m) => -- | Configuration options like base URL and security scheme Configuration -> -- | HTTP method (GET, POST, etc.) @@ -173,7 +173,7 @@ doCallWithConfiguration config method path queryParams = -- | Same as 'doCallWithConfiguration' but run in a 'MR.ReaderT' environment which contains the configuration. -- This is useful if multiple calls have to be executed with the same configuration. doCallWithConfigurationM :: - MonadHTTP m => + (MonadHTTP m) => Text -> Text -> [QueryParameter] -> @@ -291,7 +291,7 @@ serializeQueryParam QueryParameter {..} = ) $ jsonToFormDataFlat Nothing value -encodeStrict :: Aeson.ToJSON a => a -> BS.ByteString +encodeStrict :: (Aeson.ToJSON a) => a -> BS.ByteString encodeStrict = LBS.toStrict . Aeson.encode jsonToFormDataFlat :: Maybe Text -> Aeson.Value -> [(Maybe Text, BS.ByteString)] @@ -343,7 +343,7 @@ jsonToFormDataPrefixed prefix (Aeson.Array vector) = -- | This function makes the code generation for URL parameters easier as it allows to stringify a value -- -- The 'Show' class is not sufficient as strings should not be stringified with quotes. -stringifyModel :: Aeson.ToJSON a => a -> Text +stringifyModel :: (Aeson.ToJSON a) => a -> Text stringifyModel x = case Aeson.toJSON x of Aeson.String s -> s v -> toStrict $ toLazyText $ encodeToTextBuilder v @@ -378,14 +378,14 @@ instance Aeson.FromJSON JsonDateTime where data Nullable a = NonNull a | Null deriving (Show, Eq) -instance Aeson.ToJSON a => Aeson.ToJSON (Nullable a) where +instance (Aeson.ToJSON a) => Aeson.ToJSON (Nullable a) where toJSON Null = Aeson.Null toJSON (NonNull x) = Aeson.toJSON x toEncoding Null = Encoding.null_ toEncoding (NonNull x) = Aeson.toEncoding x -instance Aeson.FromJSON a => Aeson.FromJSON (Nullable a) where +instance (Aeson.FromJSON a) => Aeson.FromJSON (Nullable a) where parseJSON Aeson.Null = pure Null parseJSON x = NonNull <$> Aeson.parseJSON x diff --git a/testing/golden-output/src/OpenAPI/Types/Dog.hs b/testing/golden-output/src/OpenAPI/Types/Dog.hs index d3763ce..290b1e5 100755 --- a/testing/golden-output/src/OpenAPI/Types/Dog.hs +++ b/testing/golden-output/src/OpenAPI/Types/Dog.hs @@ -83,7 +83,7 @@ data Dog = Dog { -- | strDateTime , dogStrDateTime :: (GHC.Maybe.Maybe Data.Text.Internal.Text) -- | tags - , dogTags :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])) + , dogTags :: (GHC.Maybe.Maybe [Data.Text.Internal.Text]) } deriving (GHC.Show.Show , GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON Dog diff --git a/testing/golden-output/src/OpenAPI/Types/Mischling.hs b/testing/golden-output/src/OpenAPI/Types/Mischling.hs index 4359a27..37f634e 100755 --- a/testing/golden-output/src/OpenAPI/Types/Mischling.hs +++ b/testing/golden-output/src/OpenAPI/Types/Mischling.hs @@ -101,7 +101,7 @@ data Mischling = Mischling { -- | strDateTime , mischlingStrDateTime :: (GHC.Maybe.Maybe Data.Text.Internal.Text) -- | tags - , mischlingTags :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])) + , mischlingTags :: (GHC.Maybe.Maybe [Data.Text.Internal.Text]) } deriving (GHC.Show.Show , GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON Mischling @@ -164,7 +164,7 @@ data MischlingAnother_relativeVariants = | MischlingAnother_relativeCat Cat | MischlingAnother_relativePetByType PetByType | MischlingAnother_relativeText Data.Text.Internal.Text - | MischlingAnother_relativeListTText ([Data.Text.Internal.Text]) + | MischlingAnother_relativeListTText [Data.Text.Internal.Text] | MischlingAnother_relativeMischlingAnother_relativeOneOf5 MischlingAnother_relativeOneOf5 deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON MischlingAnother_relativeVariants diff --git a/testing/golden-output/src/OpenAPI/Types/PetByAge.hs b/testing/golden-output/src/OpenAPI/Types/PetByAge.hs index 91717b5..d1d77b6 100755 --- a/testing/golden-output/src/OpenAPI/Types/PetByAge.hs +++ b/testing/golden-output/src/OpenAPI/Types/PetByAge.hs @@ -92,7 +92,7 @@ data PetByAgeAnother_relativeVariants = | PetByAgeAnother_relativeCat Cat | PetByAgeAnother_relativePetByType PetByType | PetByAgeAnother_relativeText Data.Text.Internal.Text - | PetByAgeAnother_relativeListTText ([Data.Text.Internal.Text]) + | PetByAgeAnother_relativeListTText [Data.Text.Internal.Text] | PetByAgeAnother_relativePetByAgeAnother_relativeOneOf5 PetByAgeAnother_relativeOneOf5 deriving (GHC.Show.Show, GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON PetByAgeAnother_relativeVariants diff --git a/testing/golden-output/src/OpenAPI/Types/Test8.hs b/testing/golden-output/src/OpenAPI/Types/Test8.hs index 347c170..b7aa4e0 100755 --- a/testing/golden-output/src/OpenAPI/Types/Test8.hs +++ b/testing/golden-output/src/OpenAPI/Types/Test8.hs @@ -42,7 +42,7 @@ data Test8NonNullable = Test8NonNullable { -- | prop2 , test8NonNullableProp2 :: (GHC.Maybe.Maybe (OpenAPI.Common.Nullable Data.Text.Internal.Text)) -- | prop3 - , test8NonNullableProp3 :: (OpenAPI.Common.Nullable ([OpenAPI.Common.Nullable Data.Text.Internal.Text])) + , test8NonNullableProp3 :: (OpenAPI.Common.Nullable [OpenAPI.Common.Nullable Data.Text.Internal.Text]) } deriving (GHC.Show.Show , GHC.Classes.Eq) instance Data.Aeson.Types.ToJSON.ToJSON Test8NonNullable @@ -52,7 +52,7 @@ instance Data.Aeson.Types.FromJSON.FromJSON Test8NonNullable where {parseJSON = Data.Aeson.Types.FromJSON.withObject "Test8NonNullable" (\obj -> ((GHC.Base.pure Test8NonNullable GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "prop1")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "prop2")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "prop3"))} -- | Create a new 'Test8NonNullable' with all required fields. mkTest8NonNullable :: OpenAPI.Common.Nullable GHC.Types.Int -- ^ 'test8NonNullableProp1' - -> OpenAPI.Common.Nullable ([OpenAPI.Common.Nullable Data.Text.Internal.Text]) -- ^ 'test8NonNullableProp3' + -> OpenAPI.Common.Nullable [OpenAPI.Common.Nullable Data.Text.Internal.Text] -- ^ 'test8NonNullableProp3' -> Test8NonNullable mkTest8NonNullable test8NonNullableProp1 test8NonNullableProp3 = Test8NonNullable{test8NonNullableProp1 = test8NonNullableProp1, test8NonNullableProp2 = GHC.Maybe.Nothing, diff --git a/testing/level2/official-petstore/src/Lib.hs b/testing/level2/official-petstore/src/Lib.hs index c80f86e..4566d15 100644 --- a/testing/level2/official-petstore/src/Lib.hs +++ b/testing/level2/official-petstore/src/Lib.hs @@ -6,11 +6,11 @@ import Network.HTTP.Client import OpenAPI import OpenAPI.Common -runListPets :: MonadHTTP m => m (Response ListPetsResponse) +runListPets :: (MonadHTTP m) => m (Response ListPetsResponse) runListPets = listPetsWithConfiguration defaultConfiguration Nothing -runCreatePets :: MonadHTTP m => m (Response CreatePetsResponse) +runCreatePets :: (MonadHTTP m) => m (Response CreatePetsResponse) runCreatePets = createPetsWithConfiguration defaultConfiguration -runShowPetById :: MonadHTTP m => Text -> m (Response ShowPetByIdResponse) +runShowPetById :: (MonadHTTP m) => Text -> m (Response ShowPetByIdResponse) runShowPetById = showPetByIdWithConfiguration defaultConfiguration diff --git a/testing/level2/petstore-running-example/src/Lib.hs b/testing/level2/petstore-running-example/src/Lib.hs index 9c181c7..fd7452e 100644 --- a/testing/level2/petstore-running-example/src/Lib.hs +++ b/testing/level2/petstore-running-example/src/Lib.hs @@ -27,10 +27,10 @@ bearerConfiguration = { configSecurityScheme = bearerAuthenticationSecurityScheme "token" } -runGetInventoryAnonymous :: MonadHTTP m => m (Response GetInventoryResponse) +runGetInventoryAnonymous :: (MonadHTTP m) => m (Response GetInventoryResponse) runGetInventoryAnonymous = getInventoryWithConfiguration defaultConfiguration -runGetInventoryBasicAuth :: MonadHTTP m => m (Response GetInventoryResponse) +runGetInventoryBasicAuth :: (MonadHTTP m) => m (Response GetInventoryResponse) runGetInventoryBasicAuth = getInventoryWithConfiguration $ defaultConfiguration @@ -42,24 +42,24 @@ runGetInventoryBasicAuth = } } -runGetInventoryBearerAuth :: MonadHTTP m => m (Response GetInventoryResponse) +runGetInventoryBearerAuth :: (MonadHTTP m) => m (Response GetInventoryResponse) runGetInventoryBearerAuth = getInventoryWithConfiguration bearerConfiguration -runMultipleRequestsWithBearerAuth :: MonadHTTP m => m (Response GetInventoryResponse, Response AddPetResponse) +runMultipleRequestsWithBearerAuth :: (MonadHTTP m) => m (Response GetInventoryResponse, Response AddPetResponse) runMultipleRequestsWithBearerAuth = runWithConfiguration bearerConfiguration $ do response1 <- getInventory response2 <- addPet myPet pure (response1, response2) -runAddPet :: MonadHTTP m => m (Response AddPetResponse) +runAddPet :: (MonadHTTP m) => m (Response AddPetResponse) runAddPet = addPetWithConfiguration defaultConfiguration myPet -runGetAllPetsAsOneOf :: MonadHTTP m => m (Response GetAllPetsAsOneOfResponse) +runGetAllPetsAsOneOf :: (MonadHTTP m) => m (Response GetAllPetsAsOneOfResponse) runGetAllPetsAsOneOf = getAllPetsAsOneOfWithConfiguration defaultConfiguration -runUpdatePet :: MonadHTTP m => m (Response UpdatePetResponse) +runUpdatePet :: (MonadHTTP m) => m (Response UpdatePetResponse) runUpdatePet = updatePetWithConfiguration defaultConfiguration (UpdatePetRequestBodyPet myPet) -runUpdatePetWithTag :: MonadHTTP m => m (Response UpdatePetResponse) +runUpdatePetWithTag :: (MonadHTTP m) => m (Response UpdatePetResponse) runUpdatePetWithTag = updatePetWithConfiguration defaultConfiguration (UpdatePetRequestBodyTag myTag) diff --git a/testing/level2/stripe-api/src/Lib.hs b/testing/level2/stripe-api/src/Lib.hs index 3daa8e8..7dd4ab8 100644 --- a/testing/level2/stripe-api/src/Lib.hs +++ b/testing/level2/stripe-api/src/Lib.hs @@ -36,17 +36,17 @@ checkoutSession = postCheckoutSessionsRequestBodyPaymentMethodTypes = Just [PostCheckoutSessionsRequestBodyPaymentMethodTypes'EnumCard] } -runCheckoutSession :: MonadHTTP m => m (Response PostCheckoutSessionsResponse) +runCheckoutSession :: (MonadHTTP m) => m (Response PostCheckoutSessionsResponse) runCheckoutSession = runWithConfiguration defaultConfiguration $ postCheckoutSessions checkoutSession -runCheckoutSessionRaw :: MonadHTTP m => m (Response ByteString) +runCheckoutSessionRaw :: (MonadHTTP m) => m (Response ByteString) runCheckoutSessionRaw = runWithConfiguration defaultConfiguration $ postCheckoutSessionsRaw checkoutSession -runGetPaymentIntent :: MonadHTTP m => m (Response GetPaymentIntentsResponse) +runGetPaymentIntent :: (MonadHTTP m) => m (Response GetPaymentIntentsResponse) runGetPaymentIntent = getPaymentIntentsWithConfiguration defaultConfiguration {configBaseURL = "http://test.url"} @@ -62,7 +62,7 @@ runGetPaymentIntent = getPaymentIntentsParametersQueryStartingAfter = Just "the last string" } -runPostPaymentIntent :: MonadHTTP m => m (Response PostPaymentIntentsResponse) +runPostPaymentIntent :: (MonadHTTP m) => m (Response PostPaymentIntentsResponse) runPostPaymentIntent = postPaymentIntentsWithConfiguration defaultConfiguration myPaymentIntent where myPaymentIntent = diff --git a/testing/level3/petstore-running-example/src/Lib.hs b/testing/level3/petstore-running-example/src/Lib.hs index 16d0cfe..23a4904 100644 --- a/testing/level3/petstore-running-example/src/Lib.hs +++ b/testing/level3/petstore-running-example/src/Lib.hs @@ -8,7 +8,7 @@ import Network.HTTP.Client import OpenAPI import OpenAPI.Common -runAddPet :: MonadHTTP m => m (Response AddPetResponse) +runAddPet :: (MonadHTTP m) => m (Response AddPetResponse) runAddPet = runWithConfiguration defaultConfiguration $ addPet $ @@ -18,28 +18,28 @@ runAddPet = petStatus = Just PetStatusEnumAvailable } -runGetInventory :: MonadHTTP m => m (Response GetInventoryResponse) +runGetInventory :: (MonadHTTP m) => m (Response GetInventoryResponse) runGetInventory = getInventoryWithConfiguration defaultConfiguration -runFindPetsByStatus :: MonadHTTP m => FindPetsByStatusParametersStatus -> m (Response FindPetsByStatusResponse) +runFindPetsByStatus :: (MonadHTTP m) => FindPetsByStatusParametersStatus -> m (Response FindPetsByStatusResponse) runFindPetsByStatus status = findPetsByStatusWithConfiguration defaultConfiguration [status] -runEchoUserAgent :: MonadHTTP m => m (Response EchoUserAgentResponse) +runEchoUserAgent :: (MonadHTTP m) => m (Response EchoUserAgentResponse) runEchoUserAgent = echoUserAgentWithConfiguration $ defaultConfiguration { configApplicationName = "XYZ" } -runEchoUserAgentWithoutUserAgent :: MonadHTTP m => m (Response EchoUserAgentResponse) +runEchoUserAgentWithoutUserAgent :: (MonadHTTP m) => m (Response EchoUserAgentResponse) runEchoUserAgentWithoutUserAgent = echoUserAgentWithConfiguration $ defaultConfiguration { configIncludeUserAgent = False } -runEchoPath :: MonadHTTP m => EchoPathParametersPath -> m (Response EchoPathResponse) +runEchoPath :: (MonadHTTP m) => EchoPathParametersPath -> m (Response EchoPathResponse) runEchoPath = echoPathWithConfiguration defaultConfiguration -runSendAndReceiveNullableAndOptional :: MonadHTTP m => Text -> NullableAndOptionalTest -> m (Response SendAndReceiveNullableAndOptionalResponse) +runSendAndReceiveNullableAndOptional :: (MonadHTTP m) => Text -> NullableAndOptionalTest -> m (Response SendAndReceiveNullableAndOptionalResponse) runSendAndReceiveNullableAndOptional = sendAndReceiveNullableAndOptionalWithConfiguration defaultConfiguration diff --git a/testing/level3/petstore-running-example/test/Spec.hs b/testing/level3/petstore-running-example/test/Spec.hs index 84c2a2e..96dde2b 100644 --- a/testing/level3/petstore-running-example/test/Spec.hs +++ b/testing/level3/petstore-running-example/test/Spec.hs @@ -61,7 +61,7 @@ main = "XYZ" `T.isInfixOf` text && "openapi3-code-generator" - `T.isInfixOf` text + `T.isInfixOf` text _ -> False )