Skip to content

Commit ece9fc3

Browse files
author
Tom Sydney Kerckhove
committed
rerun pre-commit checks
1 parent 29af2e7 commit ece9fc3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2872
-1445
lines changed

.circleci/golden/expected/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{ pkgs ? import <nixpkgs> {} }:
1+
{ pkgs ? import <nixpkgs> { } }:
22
let
33
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
44
in
5-
pkgs.haskellPackages.callCabal2nix "openapi" ./. { }
5+
pkgs.haskellPackages.callCabal2nix "openapi" ./. { }

.circleci/golden/expected/shell.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{ pkgs ? import <nixpkgs> {} }:
1+
{ pkgs ? import <nixpkgs> { } }:
22
(import ./default.nix { inherit pkgs; }).env

.circleci/testing/level2/level2-base/src/Test/MonadHTTP.hs

+6-7
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ newtype BodyMismatch = BodyMismatch (Maybe ByteString)
3636

3737
instance Exception BodyMismatch
3838

39-
data RequestExpectation
40-
= RequestExpectation
41-
{ methodExpectation :: Maybe Method,
42-
urlExpectation :: Maybe String,
43-
authorizationExpectation :: Maybe String,
44-
bodyExpectation :: Maybe ByteString
45-
}
39+
data RequestExpectation = RequestExpectation
40+
{ methodExpectation :: Maybe Method,
41+
urlExpectation :: Maybe String,
42+
authorizationExpectation :: Maybe String,
43+
bodyExpectation :: Maybe ByteString
44+
}
4645

4746
noExpectation :: RequestExpectation
4847
noExpectation = RequestExpectation Nothing Nothing Nothing Nothing

.circleci/testing/level2/petstore-running-example/test/Spec.hs

+17-17
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,23 @@ main =
3636
(response1, response2) <- runMock runMultipleRequestsWithBearerAuth (requestExpectation, succeededResponse)
3737
getResponseBody response1 `shouldBe` GetInventoryResponse200 HashMap.empty
3838
getResponseBody response2 `shouldBe` AddPetResponse200
39-
describe "runAddPet"
40-
$ it "should encode Body"
41-
$ do
42-
let requestExpectation = expectBody "{\"category\":null,\"id\":null,\"name\":\"Harro\",\"photoUrls\":[],\"status\":null,\"tags\":null}" $ expectMethod "POST" noExpectation
43-
response <- runMock runAddPet (requestExpectation, succeededResponse)
44-
getResponseBody response `shouldBe` AddPetResponse200
45-
describe "runGetAllPetsAsOneOf"
46-
$ it "contain different results"
47-
$ do
48-
let rawResponse = defaultResponse {responseBody = "[1, \"test\", 2]"} :: Response ByteString
49-
response <- runMock runGetAllPetsAsOneOf (noExpectation, rawResponse)
50-
getResponseBody response
51-
`shouldBe` GetAllPetsAsOneOfResponse200
52-
[ GetAllPetsAsOneOfResponseBody200Double 1,
53-
GetAllPetsAsOneOfResponseBody200Text "test",
54-
GetAllPetsAsOneOfResponseBody200Double 2
55-
]
39+
describe "runAddPet" $
40+
it "should encode Body" $
41+
do
42+
let requestExpectation = expectBody "{\"category\":null,\"id\":null,\"name\":\"Harro\",\"photoUrls\":[],\"status\":null,\"tags\":null}" $ expectMethod "POST" noExpectation
43+
response <- runMock runAddPet (requestExpectation, succeededResponse)
44+
getResponseBody response `shouldBe` AddPetResponse200
45+
describe "runGetAllPetsAsOneOf" $
46+
it "contain different results" $
47+
do
48+
let rawResponse = defaultResponse {responseBody = "[1, \"test\", 2]"} :: Response ByteString
49+
response <- runMock runGetAllPetsAsOneOf (noExpectation, rawResponse)
50+
getResponseBody response
51+
`shouldBe` GetAllPetsAsOneOfResponse200
52+
[ GetAllPetsAsOneOfResponseBody200Double 1,
53+
GetAllPetsAsOneOfResponseBody200Text "test",
54+
GetAllPetsAsOneOfResponseBody200Double 2
55+
]
5656
describe "updatePet" $ do
5757
it "runUpdatePet" $ do
5858
let requestExpectation = expectBody "{\"photoUrls\":[],\"status\":null,\"category\":null,\"name\":\"Harro\",\"id\":null,\"tags\":null}" $ expectMethod "PUT" noExpectation

.circleci/testing/level2/stripe/test/Spec.hs

+16-16
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,22 @@ successResponseGetExpected =
7171
main :: IO ()
7272
main =
7373
hspec $ do
74-
describe "runPostPaymentIntent"
75-
$ it "should encode Body"
76-
$ do
77-
let requestExpectation = expectBody "amount=171&currency=CHF&application_fee_amount=7&payment_method_types%5B%5D=myType&payment_method_types%5B%5D=mySecondType" $ expectMethod "POST" noExpectation
78-
response <- runMock runPostPaymentIntent (requestExpectation, succeededResponse)
79-
getResponseBody response `shouldBe` PostPaymentIntentsResponse200 paymentIntent
80-
describe "runGetPaymentIntent"
81-
$ it "should encode Body"
82-
$ do
83-
let requestExpectation =
84-
expectMethod "GET" $
85-
expectURL
86-
"http://test.url/v1/payment_intents?created=3&ending_before=some_string&expand%5B%5D=another_string&limit=100&starting_after=the%20last%20string"
87-
noExpectation
88-
response <- runMock runGetPaymentIntent (requestExpectation, successResponseGet)
89-
getResponseBody response `shouldBe` GetPaymentIntentsResponse200 successResponseGetExpected
74+
describe "runPostPaymentIntent" $
75+
it "should encode Body" $
76+
do
77+
let requestExpectation = expectBody "amount=171&currency=CHF&application_fee_amount=7&payment_method_types%5B%5D=myType&payment_method_types%5B%5D=mySecondType" $ expectMethod "POST" noExpectation
78+
response <- runMock runPostPaymentIntent (requestExpectation, succeededResponse)
79+
getResponseBody response `shouldBe` PostPaymentIntentsResponse200 paymentIntent
80+
describe "runGetPaymentIntent" $
81+
it "should encode Body" $
82+
do
83+
let requestExpectation =
84+
expectMethod "GET" $
85+
expectURL
86+
"http://test.url/v1/payment_intents?created=3&ending_before=some_string&expand%5B%5D=another_string&limit=100&starting_after=the%20last%20string"
87+
noExpectation
88+
response <- runMock runGetPaymentIntent (requestExpectation, successResponseGet)
89+
getResponseBody response `shouldBe` GetPaymentIntentsResponse200 successResponseGetExpected
9090
describe "runCheckoutSession" $ do
9191
it "should encode Body" $ do
9292
let requestExpectation = expectBody "line_items%5B%5D%5Bamount%5D=1000&line_items%5B%5D%5Bquantity%5D=4&line_items%5B%5D%5Bname%5D=static%20types&line_items%5B%5D%5Bcurrency%5D=CHF&line_items%5B%5D%5Bdescription%5D=algebraic%20data%20types&line_items%5B%5D%5Bamount%5D=5000&line_items%5B%5D%5Bquantity%5D=2&line_items%5B%5D%5Bname%5D=Haskell&line_items%5B%5D%5Bcurrency%5D=CHF&line_items%5B%5D%5Bdescription%5D=lambda%20calculus&success_url=https%3A%2F%2Flocalhost%3A8080%2Fpayments%2Findex.html%3Fsuccess%3Dtrue%26sessionId%3D%7BCHECKOUT_SESSION_ID%7D&cancel_url=https%3A%2F%2Flocalhost%3A8080%2Fpayments%2Findex.html%3Fsuccess%3Dfalse%26sessionId%3D%7BCHECKOUT_SESSION_ID%7D&payment_method_types%5B%5D=card" $ expectMethod "POST" noExpectation

.circleci/testing/level3/petstore-running-example/test/Spec.hs

+29-29
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,32 @@ import Test.Hspec
1212
main :: IO ()
1313
main =
1414
hspec $ do
15-
describe "runGetInventory"
16-
$ it "get inventory"
17-
$ do
18-
response <- runGetInventory
19-
getResponseBody response
20-
`shouldSatisfy` ( \case
21-
GetInventoryResponse200 _ -> True
22-
_ -> False
23-
)
24-
describe "runAddPetAndFindIt"
25-
$ it "add pet and find it"
26-
$ do
27-
(response1, response2) <- runAddPetAndFindIt
28-
getResponseBody response1
29-
`shouldBe` AddPetResponse200
30-
getResponseBody response2
31-
`shouldSatisfy` ( \case
32-
FindPetsByStatusResponse200 pets -> any (\p -> petName p == Just "Harro") pets
33-
_ -> False
34-
)
35-
describe "runFindPetsByStatus"
36-
$ it "find pets by status"
37-
$ do
38-
response <- runFindPetsByStatus
39-
getResponseBody response
40-
`shouldSatisfy` ( \case
41-
FindPetsByStatusResponse200 _ -> True
42-
_ -> False
43-
)
15+
describe "runGetInventory" $
16+
it "get inventory" $
17+
do
18+
response <- runGetInventory
19+
getResponseBody response
20+
`shouldSatisfy` ( \case
21+
GetInventoryResponse200 _ -> True
22+
_ -> False
23+
)
24+
describe "runAddPetAndFindIt" $
25+
it "add pet and find it" $
26+
do
27+
(response1, response2) <- runAddPetAndFindIt
28+
getResponseBody response1
29+
`shouldBe` AddPetResponse200
30+
getResponseBody response2
31+
`shouldSatisfy` ( \case
32+
FindPetsByStatusResponse200 pets -> any (\p -> petName p == Just "Harro") pets
33+
_ -> False
34+
)
35+
describe "runFindPetsByStatus" $
36+
it "find pets by status" $
37+
do
38+
response <- runFindPetsByStatus
39+
getResponseBody response
40+
`shouldSatisfy` ( \case
41+
FindPetsByStatusResponse200 _ -> True
42+
_ -> False
43+
)

.hlint.yaml

+1-63
Original file line numberDiff line numberDiff line change
@@ -1,63 +1 @@
1-
# HLint configuration file
2-
# https://github.com/ndmitchell/hlint
3-
##########################
4-
5-
# This file contains a template configuration file, which is typically
6-
# placed as .hlint.yaml in the root of your project
7-
8-
9-
# Warnings currently triggered by your code
10-
11-
12-
# Specify additional command line arguments
13-
#
14-
# - arguments: [--color, --cpp-simple, -XQuasiQuotes]
15-
16-
17-
# Control which extensions/flags/modules/functions can be used
18-
#
19-
# - extensions:
20-
# - default: false # all extension are banned by default
21-
# - name: [PatternGuards, ViewPatterns] # only these listed extensions can be used
22-
# - {name: CPP, within: CrossPlatform} # CPP can only be used in a given module
23-
#
24-
# - flags:
25-
# - {name: -w, within: []} # -w is allowed nowhere
26-
#
27-
# - modules:
28-
# - {name: [Data.Set, Data.HashSet], as: Set} # if you import Data.Set qualified, it must be as 'Set'
29-
# - {name: Control.Arrow, within: []} # Certain modules are banned entirely
30-
#
31-
# - functions:
32-
# - {name: unsafePerformIO, within: []} # unsafePerformIO can only appear in no modules
33-
34-
35-
# Add custom hints for this project
36-
#
37-
# Will suggest replacing "wibbleMany [myvar]" with "wibbleOne myvar"
38-
# - error: {lhs: "wibbleMany [x]", rhs: wibbleOne x}
39-
40-
41-
# Turn on hints that are off by default
42-
#
43-
# Ban "module X(module X) where", to require a real export list
44-
# - warn: {name: Use explicit module export list}
45-
#
46-
# Replace a $ b $ c with a . b $ c
47-
# - group: {name: dollar, enabled: true}
48-
#
49-
# Generalise map to fmap, ++ to <>
50-
# - group: {name: generalise, enabled: true}
51-
52-
53-
# Ignore some builtin hints
54-
# - ignore: {name: Use let}
55-
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
56-
57-
58-
# Define some custom infix operators
59-
# - fixity: infixr 3 ~^#^~
60-
61-
62-
# To generate a suitable file for HLint do:
63-
# $ hlint --default > .hlint.yaml
1+
- ignore: {name: Redundant bracket}

default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ in
99
hooks = {
1010
ormolu = {
1111
enable = true;
12-
excludes = [ ".circleci/golden" ];
12+
excludes = [ ".circleci/golden" "example" ];
1313
};
1414
hlint = {
1515
enable = true;
16-
excludes = [ ".circleci/golden" ];
16+
excludes = [ ".circleci/golden" "example" ];
1717
};
1818
nixpkgs-fmt.enable = true;
1919
};

example/generatedCode/src/OpenAPI.hs

+51-50
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
11
-- | The main module which exports all functionality.
2-
module OpenAPI (
3-
module OpenAPI.Operations.UpdatePet,
4-
module OpenAPI.Operations.AddPet,
5-
module OpenAPI.Operations.FindPetsByStatus,
6-
module OpenAPI.Operations.FindPetsByTags,
7-
module OpenAPI.Operations.GetPetById,
8-
module OpenAPI.Operations.UpdatePetWithForm,
9-
module OpenAPI.Operations.DeletePet,
10-
module OpenAPI.Operations.UploadFile,
11-
module OpenAPI.Operations.GetInventory,
12-
module OpenAPI.Operations.PlaceOrder,
13-
module OpenAPI.Operations.GetOrderById,
14-
module OpenAPI.Operations.DeleteOrder,
15-
module OpenAPI.Operations.CreateUser,
16-
module OpenAPI.Operations.CreateUsersWithArrayInput,
17-
module OpenAPI.Operations.CreateUsersWithListInput,
18-
module OpenAPI.Operations.LoginUser,
19-
module OpenAPI.Operations.LogoutUser,
20-
module OpenAPI.Operations.GetUserByName,
21-
module OpenAPI.Operations.UpdateUser,
22-
module OpenAPI.Operations.DeleteUser,
23-
module OpenAPI.Types,
24-
module OpenAPI.CyclicTypes,
25-
module OpenAPI.Types.ApiResponse,
26-
module OpenAPI.Types.Category,
27-
module OpenAPI.Types.Order,
28-
module OpenAPI.Types.Tag,
29-
module OpenAPI.Types.User,
30-
module OpenAPI.Types.Pet,
31-
module OpenAPI.Configuration,
32-
module OpenAPI.SecuritySchemes,
33-
module OpenAPI.Common,
34-
) where
2+
module OpenAPI
3+
( module OpenAPI.Operations.UpdatePet,
4+
module OpenAPI.Operations.AddPet,
5+
module OpenAPI.Operations.FindPetsByStatus,
6+
module OpenAPI.Operations.FindPetsByTags,
7+
module OpenAPI.Operations.GetPetById,
8+
module OpenAPI.Operations.UpdatePetWithForm,
9+
module OpenAPI.Operations.DeletePet,
10+
module OpenAPI.Operations.UploadFile,
11+
module OpenAPI.Operations.GetInventory,
12+
module OpenAPI.Operations.PlaceOrder,
13+
module OpenAPI.Operations.GetOrderById,
14+
module OpenAPI.Operations.DeleteOrder,
15+
module OpenAPI.Operations.CreateUser,
16+
module OpenAPI.Operations.CreateUsersWithArrayInput,
17+
module OpenAPI.Operations.CreateUsersWithListInput,
18+
module OpenAPI.Operations.LoginUser,
19+
module OpenAPI.Operations.LogoutUser,
20+
module OpenAPI.Operations.GetUserByName,
21+
module OpenAPI.Operations.UpdateUser,
22+
module OpenAPI.Operations.DeleteUser,
23+
module OpenAPI.Types,
24+
module OpenAPI.CyclicTypes,
25+
module OpenAPI.Types.ApiResponse,
26+
module OpenAPI.Types.Category,
27+
module OpenAPI.Types.Order,
28+
module OpenAPI.Types.Tag,
29+
module OpenAPI.Types.User,
30+
module OpenAPI.Types.Pet,
31+
module OpenAPI.Configuration,
32+
module OpenAPI.SecuritySchemes,
33+
module OpenAPI.Common,
34+
)
35+
where
3536

36-
import OpenAPI.Operations.UpdatePet
37+
import OpenAPI.Common
38+
import OpenAPI.Configuration
39+
import OpenAPI.CyclicTypes
3740
import OpenAPI.Operations.AddPet
41+
import OpenAPI.Operations.CreateUser
42+
import OpenAPI.Operations.CreateUsersWithArrayInput
43+
import OpenAPI.Operations.CreateUsersWithListInput
44+
import OpenAPI.Operations.DeleteOrder
45+
import OpenAPI.Operations.DeletePet
46+
import OpenAPI.Operations.DeleteUser
3847
import OpenAPI.Operations.FindPetsByStatus
3948
import OpenAPI.Operations.FindPetsByTags
40-
import OpenAPI.Operations.GetPetById
41-
import OpenAPI.Operations.UpdatePetWithForm
42-
import OpenAPI.Operations.DeletePet
43-
import OpenAPI.Operations.UploadFile
4449
import OpenAPI.Operations.GetInventory
45-
import OpenAPI.Operations.PlaceOrder
4650
import OpenAPI.Operations.GetOrderById
47-
import OpenAPI.Operations.DeleteOrder
48-
import OpenAPI.Operations.CreateUser
49-
import OpenAPI.Operations.CreateUsersWithArrayInput
50-
import OpenAPI.Operations.CreateUsersWithListInput
51+
import OpenAPI.Operations.GetPetById
52+
import OpenAPI.Operations.GetUserByName
5153
import OpenAPI.Operations.LoginUser
5254
import OpenAPI.Operations.LogoutUser
53-
import OpenAPI.Operations.GetUserByName
55+
import OpenAPI.Operations.PlaceOrder
56+
import OpenAPI.Operations.UpdatePet
57+
import OpenAPI.Operations.UpdatePetWithForm
5458
import OpenAPI.Operations.UpdateUser
55-
import OpenAPI.Operations.DeleteUser
59+
import OpenAPI.Operations.UploadFile
60+
import OpenAPI.SecuritySchemes
5661
import OpenAPI.Types
57-
import OpenAPI.CyclicTypes
5862
import OpenAPI.Types.ApiResponse
5963
import OpenAPI.Types.Category
6064
import OpenAPI.Types.Order
65+
import OpenAPI.Types.Pet
6166
import OpenAPI.Types.Tag
6267
import OpenAPI.Types.User
63-
import OpenAPI.Types.Pet
64-
import OpenAPI.Configuration
65-
import OpenAPI.SecuritySchemes
66-
import OpenAPI.Common

0 commit comments

Comments
 (0)