Skip to content

Commit 71e7c4a

Browse files
committed
Fixed CI
1 parent 568f819 commit 71e7c4a

File tree

19 files changed

+77
-77
lines changed

19 files changed

+77
-77
lines changed

example/generatedCode/src/OpenAPI/Common.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ import qualified Data.HashMap.Strict as HMap
6464

6565
-- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away,
6666
-- so that it can be used for testing
67-
class Monad m => MonadHTTP m where
67+
class (Monad m) => MonadHTTP m where
6868
httpBS :: HS.Request -> m (HS.Response BS.ByteString)
6969

7070
-- | This instance is the default instance used for production code
7171
instance MonadHTTP IO where
7272
httpBS = HS.httpBS
7373

74-
instance MonadHTTP m => MonadHTTP (MR.ReaderT r m) where
74+
instance (MonadHTTP m) => MonadHTTP (MR.ReaderT r m) where
7575
httpBS = MT.lift . httpBS
7676

77-
instance MonadHTTP m => MonadHTTP (ClientT m) where
77+
instance (MonadHTTP m) => MonadHTTP (ClientT m) where
7878
httpBS = MT.lift . httpBS
7979

8080
-- | The monad in which the operations can be run.
@@ -87,7 +87,7 @@ newtype ClientT m a = ClientT (MR.ReaderT Configuration m a)
8787
instance MT.MonadTrans ClientT where
8888
lift = ClientT . MT.lift
8989

90-
instance MIO.MonadIO m => MIO.MonadIO (ClientT m) where
90+
instance (MIO.MonadIO m) => MIO.MonadIO (ClientT m) where
9191
liftIO = ClientT . MIO.liftIO
9292

9393
-- | Utility type which uses 'IO' as underlying monad
@@ -156,7 +156,7 @@ anonymousSecurityScheme = id
156156
--
157157
-- It makes a concrete Call to a Server without a body
158158
doCallWithConfiguration ::
159-
MonadHTTP m =>
159+
(MonadHTTP m) =>
160160
-- | Configuration options like base URL and security scheme
161161
Configuration ->
162162
-- | HTTP method (GET, POST, etc.)
@@ -173,7 +173,7 @@ doCallWithConfiguration config method path queryParams =
173173
-- | Same as 'doCallWithConfiguration' but run in a 'MR.ReaderT' environment which contains the configuration.
174174
-- This is useful if multiple calls have to be executed with the same configuration.
175175
doCallWithConfigurationM ::
176-
MonadHTTP m =>
176+
(MonadHTTP m) =>
177177
Text ->
178178
Text ->
179179
[QueryParameter] ->
@@ -291,7 +291,7 @@ serializeQueryParam QueryParameter {..} =
291291
)
292292
$ jsonToFormDataFlat Nothing value
293293

294-
encodeStrict :: Aeson.ToJSON a => a -> BS.ByteString
294+
encodeStrict :: (Aeson.ToJSON a) => a -> BS.ByteString
295295
encodeStrict = LBS.toStrict . Aeson.encode
296296

297297
jsonToFormDataFlat :: Maybe Text -> Aeson.Value -> [(Maybe Text, BS.ByteString)]
@@ -343,7 +343,7 @@ jsonToFormDataPrefixed prefix (Aeson.Array vector) =
343343
-- | This function makes the code generation for URL parameters easier as it allows to stringify a value
344344
--
345345
-- The 'Show' class is not sufficient as strings should not be stringified with quotes.
346-
stringifyModel :: Aeson.ToJSON a => a -> Text
346+
stringifyModel :: (Aeson.ToJSON a) => a -> Text
347347
stringifyModel x = case Aeson.toJSON x of
348348
Aeson.String s -> s
349349
v -> toStrict $ toLazyText $ encodeToTextBuilder v
@@ -378,14 +378,14 @@ instance Aeson.FromJSON JsonDateTime where
378378
data Nullable a = NonNull a | Null
379379
deriving (Show, Eq)
380380

381-
instance Aeson.ToJSON a => Aeson.ToJSON (Nullable a) where
381+
instance (Aeson.ToJSON a) => Aeson.ToJSON (Nullable a) where
382382
toJSON Null = Aeson.Null
383383
toJSON (NonNull x) = Aeson.toJSON x
384384

385385
toEncoding Null = Encoding.null_
386386
toEncoding (NonNull x) = Aeson.toEncoding x
387387

388-
instance Aeson.FromJSON a => Aeson.FromJSON (Nullable a) where
388+
instance (Aeson.FromJSON a) => Aeson.FromJSON (Nullable a) where
389389
parseJSON Aeson.Null = pure Null
390390
parseJSON x = NonNull <$> Aeson.parseJSON x
391391

example/generatedCode/src/OpenAPI/Operations/FindPetsByStatus.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import OpenAPI.Types
5151
findPetsByStatus :: forall m . OpenAPI.Common.MonadHTTP m => [FindPetsByStatusParametersStatus] -- ^ status: Status values that need to be considered for filter
5252
-> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response FindPetsByStatusResponse) -- ^ Monadic computation which returns the result of the operation
5353
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
54-
([Pet]))
54+
[Pet])
5555
| (\status_2 -> Network.HTTP.Types.Status.statusCode status_2 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByStatusResponse400
5656
| 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])
5757
-- | 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
8080
-- 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.
8181
data FindPetsByStatusResponse =
8282
FindPetsByStatusResponseError GHC.Base.String -- ^ Means either no matching case available or a parse error
83-
| FindPetsByStatusResponse200 ([Pet]) -- ^ successful operation
83+
| FindPetsByStatusResponse200 [Pet] -- ^ successful operation
8484
| FindPetsByStatusResponse400 -- ^ Invalid status value
8585
deriving (GHC.Show.Show, GHC.Classes.Eq)
8686
-- | > GET /pet/findByStatus
@@ -91,7 +91,7 @@ findPetsByStatusWithConfiguration :: forall m . OpenAPI.Common.MonadHTTP m => Op
9191
-> m (Network.HTTP.Client.Types.Response FindPetsByStatusResponse) -- ^ Monadic computation which returns the result of the operation
9292
findPetsByStatusWithConfiguration config
9393
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
94-
([Pet]))
94+
[Pet])
9595
| (\status_5 -> Network.HTTP.Types.Status.statusCode status_5 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByStatusResponse400
9696
| 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])
9797
-- | > GET /pet/findByStatus

example/generatedCode/src/OpenAPI/Operations/FindPetsByTags.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ import OpenAPI.Types
5151
findPetsByTags :: forall m . OpenAPI.Common.MonadHTTP m => [Data.Text.Internal.Text] -- ^ tags: Tags to filter by
5252
-> OpenAPI.Common.ClientT m (Network.HTTP.Client.Types.Response FindPetsByTagsResponse) -- ^ Monadic computation which returns the result of the operation
5353
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
54-
([Pet]))
54+
[Pet])
5555
| (\status_2 -> Network.HTTP.Types.Status.statusCode status_2 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByTagsResponse400
5656
| 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])
5757
-- | Represents a response of the operation 'findPetsByTags'.
5858
--
5959
-- 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.
6060
data FindPetsByTagsResponse =
6161
FindPetsByTagsResponseError GHC.Base.String -- ^ Means either no matching case available or a parse error
62-
| FindPetsByTagsResponse200 ([Pet]) -- ^ successful operation
62+
| FindPetsByTagsResponse200 [Pet] -- ^ successful operation
6363
| FindPetsByTagsResponse400 -- ^ Invalid tag value
6464
deriving (GHC.Show.Show, GHC.Classes.Eq)
6565
-- | > GET /pet/findByTags
@@ -70,7 +70,7 @@ findPetsByTagsWithConfiguration :: forall m . OpenAPI.Common.MonadHTTP m => Open
7070
-> m (Network.HTTP.Client.Types.Response FindPetsByTagsResponse) -- ^ Monadic computation which returns the result of the operation
7171
findPetsByTagsWithConfiguration config
7272
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
73-
([Pet]))
73+
[Pet])
7474
| (\status_5 -> Network.HTTP.Types.Status.statusCode status_5 GHC.Classes.== 400) (Network.HTTP.Client.Types.responseStatus response) -> Data.Either.Right FindPetsByTagsResponse400
7575
| 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])
7676
-- | > GET /pet/findByTags

example/generatedCode/src/OpenAPI/Types/Pet.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ data Pet = Pet {
4646
-- | name
4747
, petName :: Data.Text.Internal.Text
4848
-- | photoUrls
49-
, petPhotoUrls :: ([Data.Text.Internal.Text])
49+
, petPhotoUrls :: [Data.Text.Internal.Text]
5050
-- | status: pet status in the store
5151
, petStatus :: (GHC.Maybe.Maybe PetStatus)
5252
-- | tags
53-
, petTags :: (GHC.Maybe.Maybe ([Tag]))
53+
, petTags :: (GHC.Maybe.Maybe [Tag])
5454
} deriving (GHC.Show.Show
5555
, GHC.Classes.Eq)
5656
instance Data.Aeson.Types.ToJSON.ToJSON Pet

example/src/Lib.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Network.HTTP.Client
77
import OpenAPI
88
import OpenAPI.Common
99

10-
runAddPet :: MonadHTTP m => m (Response AddPetResponse)
10+
runAddPet :: (MonadHTTP m) => m (Response AddPetResponse)
1111
runAddPet = runWithConfiguration defaultConfiguration (addPet myPet)
1212
where
1313
myPet =
@@ -20,10 +20,10 @@ runAddPet = runWithConfiguration defaultConfiguration (addPet myPet)
2020
petTags = Nothing
2121
}
2222

23-
runGetInventory :: MonadHTTP m => m (Response GetInventoryResponse)
23+
runGetInventory :: (MonadHTTP m) => m (Response GetInventoryResponse)
2424
runGetInventory = runWithConfiguration defaultConfiguration getInventory
2525

26-
runFindPetsByStatus :: MonadHTTP m => m (Response FindPetsByStatusResponse)
26+
runFindPetsByStatus :: (MonadHTTP m) => m (Response FindPetsByStatusResponse)
2727
runFindPetsByStatus =
2828
runWithConfiguration
2929
defaultConfiguration

openapi3-code-generator/src/OpenAPI/Common.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ import qualified Data.HashMap.Strict as HMap
6464

6565
-- | Abstracts the usage of 'Network.HTTP.Simple.httpBS' away,
6666
-- so that it can be used for testing
67-
class Monad m => MonadHTTP m where
67+
class (Monad m) => MonadHTTP m where
6868
httpBS :: HS.Request -> m (HS.Response BS.ByteString)
6969

7070
-- | This instance is the default instance used for production code
7171
instance MonadHTTP IO where
7272
httpBS = HS.httpBS
7373

74-
instance MonadHTTP m => MonadHTTP (MR.ReaderT r m) where
74+
instance (MonadHTTP m) => MonadHTTP (MR.ReaderT r m) where
7575
httpBS = MT.lift . httpBS
7676

77-
instance MonadHTTP m => MonadHTTP (ClientT m) where
77+
instance (MonadHTTP m) => MonadHTTP (ClientT m) where
7878
httpBS = MT.lift . httpBS
7979

8080
-- | The monad in which the operations can be run.
@@ -87,7 +87,7 @@ newtype ClientT m a = ClientT (MR.ReaderT Configuration m a)
8787
instance MT.MonadTrans ClientT where
8888
lift = ClientT . MT.lift
8989

90-
instance MIO.MonadIO m => MIO.MonadIO (ClientT m) where
90+
instance (MIO.MonadIO m) => MIO.MonadIO (ClientT m) where
9191
liftIO = ClientT . MIO.liftIO
9292

9393
-- | Utility type which uses 'IO' as underlying monad
@@ -156,7 +156,7 @@ anonymousSecurityScheme = id
156156
--
157157
-- It makes a concrete Call to a Server without a body
158158
doCallWithConfiguration ::
159-
MonadHTTP m =>
159+
(MonadHTTP m) =>
160160
-- | Configuration options like base URL and security scheme
161161
Configuration ->
162162
-- | HTTP method (GET, POST, etc.)
@@ -173,7 +173,7 @@ doCallWithConfiguration config method path queryParams =
173173
-- | Same as 'doCallWithConfiguration' but run in a 'MR.ReaderT' environment which contains the configuration.
174174
-- This is useful if multiple calls have to be executed with the same configuration.
175175
doCallWithConfigurationM ::
176-
MonadHTTP m =>
176+
(MonadHTTP m) =>
177177
Text ->
178178
Text ->
179179
[QueryParameter] ->
@@ -291,7 +291,7 @@ serializeQueryParam QueryParameter {..} =
291291
)
292292
$ jsonToFormDataFlat Nothing value
293293

294-
encodeStrict :: Aeson.ToJSON a => a -> BS.ByteString
294+
encodeStrict :: (Aeson.ToJSON a) => a -> BS.ByteString
295295
encodeStrict = LBS.toStrict . Aeson.encode
296296

297297
jsonToFormDataFlat :: Maybe Text -> Aeson.Value -> [(Maybe Text, BS.ByteString)]
@@ -343,7 +343,7 @@ jsonToFormDataPrefixed prefix (Aeson.Array vector) =
343343
-- | This function makes the code generation for URL parameters easier as it allows to stringify a value
344344
--
345345
-- The 'Show' class is not sufficient as strings should not be stringified with quotes.
346-
stringifyModel :: Aeson.ToJSON a => a -> Text
346+
stringifyModel :: (Aeson.ToJSON a) => a -> Text
347347
stringifyModel x = case Aeson.toJSON x of
348348
Aeson.String s -> s
349349
v -> toStrict $ toLazyText $ encodeToTextBuilder v
@@ -378,14 +378,14 @@ instance Aeson.FromJSON JsonDateTime where
378378
data Nullable a = NonNull a | Null
379379
deriving (Show, Eq)
380380

381-
instance Aeson.ToJSON a => Aeson.ToJSON (Nullable a) where
381+
instance (Aeson.ToJSON a) => Aeson.ToJSON (Nullable a) where
382382
toJSON Null = Aeson.Null
383383
toJSON (NonNull x) = Aeson.toJSON x
384384

385385
toEncoding Null = Encoding.null_
386386
toEncoding (NonNull x) = Aeson.toEncoding x
387387

388-
instance Aeson.FromJSON a => Aeson.FromJSON (Nullable a) where
388+
instance (Aeson.FromJSON a) => Aeson.FromJSON (Nullable a) where
389389
parseJSON Aeson.Null = pure Null
390390
parseJSON x = NonNull <$> Aeson.parseJSON x
391391

0 commit comments

Comments
 (0)